Re: [PATCH] i2c: designware: platdrv: Set class based on dmi

From: Andy Shevchenko
Date: Wed Jun 24 2020 - 06:46:58 EST


On Wed, Jun 24, 2020 at 11:12:39AM +0200, Ricardo Ribalda wrote:
> Current AMD's zen-based APUs use this core for some of its i2c-buses.
>
> With this patch we re-enable autodetection of hwmon-alike devices, so
> lm-sensors will be able to work automatically.
>
> It does not affect the boot-time of embedded devices, as the class is
> set based on the dmi information.

Hmm... Do we really need to have DMI? I mean wouldn't be safe just always
provide this to be compatible with HWMON class?

...

> +static bool dw_i2c_hwmon_bus(void)
> +{
> + if (strstr(dmi_get_system_info(DMI_PRODUCT_NAME), "QT5222"))
> + return true;
> + return false;
> +}

I don't like this. Perhaps for now you may simple use dmi_get_system_info()
directly below.

...

> + adap->class = dw_i2c_hwmon_bus() ? I2C_CLASS_HWMON
> + : I2C_CLASS_DEPRECATED;

It's one line.

--
With Best Regards,
Andy Shevchenko