lkml.org 
[lkml]   [2020]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] i2c: designware: platdrv: Set class based on dmi
On Wed, Jun 24, 2020 at 01:25:30PM +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.

I think it misses Fixes tag. And...

...

> +static bool dw_i2c_hwmon_bus(void)
> +{

> + const char *product_name = dmi_get_system_info(DMI_PRODUCT_NAME);

Split this, so the assignment will be attached to the check below.

> + if (!product_name)
> + return false;
> +

> + if (strstr(product_name, "QT5222"))
> + return true;

I don't like this part at all. Why do you need strstr()? Can you provide in the
commit message relevant fields from dmidecode (or sysfs)?

> + return false;
> +}

In general it's not how we do DMI based quirks, rather using table and call
match function. In that case you can take class as a driver_data. Much more
flexible in case we need to extend.

...

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

...since the patch has it unconditionally, I would go unconditionally. But if
Wolfram insists, then see above.


--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2020-06-24 15:26    [W:0.054 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site