Re: [PATCH v1 1/1] auxdisplay: ht16k33: Make use of i2c_get_match_data()

From: Robin van der Gracht
Date: Wed Oct 02 2024 - 08:11:01 EST


Hi Andy,

On Mon, 30 Sep 2024 16:26:42 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> Get matching data in one step by switching to use i2c_get_match_data().
> As a positive side effect the I²C ID table is in sync of OF one.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>
> I believe this is correct update. And here is why.
>
> 1) The documentation of the I2C user space device instantiation does not
> mention a compatible string. it relies on the term 'name', which I believe
> has direct link to the field .name in the struct i2c_device_id.

Ack.

> 2) The above mentioned documentation says explicitly when user space
> instantiation should be used. And for this driver it seems the only last
> piece might be the case, i.e. prototyping / DIY configuration. For this
> we don't need to rely on vendor ID anyway as in new supported hardware
> the DT/ACPI emumeration is assumed.

Not sure what you mean here. It's statically declared in the device tree for the
imx6dl-victgo board [1].

> 3) Moreover, the currently used i2c_of_match_device() seems never be
> considered to be used outside of i2c subsystem. Note, that it's being
> used for device matching and probe, meaning firmware tables and board
> info.

4) It seems your change will also allows matching the device when it's
enumerated through ACPI.

> Also note, that the other (yes, it's ONLY 2 drivers call this API)
> user of that API is going to be updated as well. Taking 3) into account
> I think soon we remove that API from bein exported to the modules.

i2c_of_match_device_sysfs() also matches the user input with the driver
compatible string(s). Which is no longer true when i2c_get_match_data() is used.

Not sure if it make sense to match against the compatible string at this point
though. Because I'm not sure if the device can be instantiated through
user space by using the compatible string in the first place. If so, there would
only be 2 drives that can get their match data...

The documentation doesn't mention the compatible string for user space
instantiating just to use "the name of the I2C device".

So maybe it's a good thing to remove that API or at least part of it.

Regardless, the change looks good to me.

Reviewed-by: Robin van der Gracht <robin@xxxxxxxxxxx>

Regards,
Robin

1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/nxp/imx/imx6dl-victgo.dts?h=v6.12-rc1#n278