RE: [PATCH v2 2/2] i2c: Add i2c_device_get_match_data() callback

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

 



Hi Andy Shevchenko,

Thanks for the feedback.

> Subject: Re: [PATCH v2 2/2] i2c: Add i2c_device_get_match_data()
> callback
> 
> On Wed, Jul 26, 2023 at 02:08:04PM +0100, Biju Das wrote:
> > Add i2c_device_get_match_data() callback to struct bus_type().
> >
> > While at it, introduced i2c_get_match_data_helper() to avoid code
> > duplication with i2c_get_match_data().
> 
> I have not been Cc'ed to this...

I execute one script per patch, to pick the recipient list. Somehow it did not pick your name. Next time I will make sure you are on the Cc list.

> 
> ...
> 
> > +static const void *i2c_device_get_match_data(const struct device
> > +*dev) {
> > +	const struct i2c_client *client = (dev->type ==
> &i2c_client_type) ?
> > +					  to_i2c_client(dev) : NULL;
> 
> There is an API i2c_verify_client() or something like this, I don't
> remember by heart.

Dmitry already responded.

> 
> > +	if (!dev->driver)
> > +		return NULL;
> > +
> > +	return i2c_get_match_data_helper(to_i2c_driver(dev->driver),
> > +client); }
> 
> ...
> 
> > +const void *i2c_get_match_data(const struct i2c_client *client) {
> > +	const struct i2c_driver *driver = to_i2c_driver(client-
> >dev.driver);
> >  	const void *data;
> >
> >  	data = device_get_match_data(&client->dev);
> > -	if (!data) {
> > -		match = i2c_match_id(driver->id_table, client);
> > -		if (!match)
> > -			return NULL;
> > -
> > -		data = (const void *)match->driver_data;
> > -	}
> > +	if (!data)
> > +		data = i2c_get_match_data_helper(driver, client);
> 
> 	if (data)
> 		return data;
> 
> 	return i2c_...;

OK.

> 
> >
> >  	return data;
> >  }
> 
> ...
> 
> Side question, what is the idea for i2c_of_match_device()? Shouldn't you
> also take it into consideration?

I guess you are ok with Dmitry's suggestion.

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