RE: [PATCH v3] i2c: Add i2c_get_match_data()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH v3] i2c: Add i2c_get_match_data()
> 
> Hi Biju,
> 
> On Wed, Jun 7, 2023 at 9:21 AM Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> wrote:

Wolfram,

What is your preference in supporting OF/ACPI/I2C match-data as in [A]?

Or

Just support OF/i2C match-data as in [B]?

> > Do we need to enhance the logic to use device_get_match_data to
> > support OF/ACPI/I2C match like below [1].
> 
> Why not?
> 
> >
> > Or
> >

> > Are we happy with the current one?
> 
> I don't mind.
> 

[A]

> > +const void *i2c_get_match_data(const struct i2c_client *client) {
> > +       struct device_driver *drv = client->dev.driver;
> > +       struct i2c_driver *driver = to_i2c_driver(drv);
> > +       const struct i2c_device_id *match;
> > +       const void *data;
> > +
> > +       data = device_get_match_data(&client->dev);
> 
>     if (data)
>             return data;
> 
> > +       if (!data) {
> > +               match = i2c_match_id(driver->id_table, client);
> > +               if (!match)
> > +                       return NULL;
> > +
> > +               data = (const void *)match->driver_data;
> > +       }
> > +
> > > +     return data;
> > > +}
> > > +EXPORT_SYMBOL(i2c_get_match_data);
> 
> > > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> 
> > > --- a/drivers/i2c/i2c-core-base.c
> > > +++ b/drivers/i2c/i2c-core-base.c
> > > @@ -114,6 +114,27 @@ const struct i2c_device_id *i2c_match_id(const
> > > struct i2c_device_id *id,  }  EXPORT_SYMBOL_GPL(i2c_match_id);
> > >

[B]

> > > +const void *i2c_get_match_data(const struct i2c_client *client) {
> > > +     struct device_driver *drv = client->dev.driver;
> > > +     struct i2c_driver *driver = to_i2c_driver(drv);
> > > +     const struct i2c_device_id *match;
> > > +     const void *data;
> > > +
> > > +     if (client->dev.of_node) {
> > > +             data = of_device_get_match_data(&client->dev);
> 
> return of_device_get_match_data(&client->dev);
> 
> > > +     } else {
> > > +             match = i2c_match_id(driver->id_table, client);
> > > +             if (!match)
> > > +                     return NULL;
> > > +
> > > +             data = (const void *)match->driver_data;
> 
> return ...
> 
> > > +     }
> > > +
> > > +     return data;
> > > +}
> > > +EXPORT_SYMBOL(i2c_get_match_data);
> 

Cheers,
Biju




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux