Re: [PATCH 1/2] i2c: consider devices with of_match_table during i2c device probing

Sergey Senozhatsky
2020-08-26T10:10:01Z

On (20/08/26 12:53), Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 02:25:44PM +0900, Sergey Senozhatsky wrote:
> > On (20/08/26 07:08), Wolfram Sang wrote:
> > > On Wed, Aug 26, 2020 at 01:29:37PM +0900, Sergey Senozhatsky wrote:
[..]

> > > > i2c_of_match_device() depends on CONFIG_OF and, thus, is always false.
> > > > i2c_acpi_match_device() does ACPI match only, no of_comtatible() matching
> > > > takes place, even though the device provides .of_match_table and ACPI,
> > > > technically, is capable of matching such device. The result is -ENODEV.
> > > > Probing will succeed, however, if we'd use .of_match_table aware ACPI
> > > > matching.
>
> Looks like you read same StackOverflow question :-)

Nope :) Ran into actual media/i2c driver probing issue several days ago

[..]
> > if (!driver->id_table &&
> > - !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
> > - !i2c_of_match_device(dev->driver->of_match_table, client)) {
> > + !(client && i2c_device_match(&client->dev, dev->driver))) {
>
> You probably meant simply:
>
> if (!i2c_device_match(dev, dev->driver)) {
>
> > status = -ENODEV;
> > goto put_sync_adapter;
> > }

That's shorter, yes. I wanted to keep the existing "workaround" in order
to avoid extra id_table matching. Because it probably will take place
earlier somewhere in

bus_for_each_dev()
__driver_attach()
i2c_device_match() // OF ACPI id_table match

> On the first glance it will work the same way but slightly longer in case of ID
> table matching.

Right.

-ss