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

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

 



Hi Wolfram,

> Subject: Re: [PATCH v2] i2c: Add i2c_get_match_data()
> 
> 
> > You mean like below?? The new helper function will do both I2C and DT-
> based matching??
> > 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 *match_data;
> >
> > 	if (client->dev.of_node){
> > 		match_data = of_device_get_match_data(&client->dev);
> > 	} else {
> > 	      match = i2c_match_id(driver->id_table, client);
> > 	      if (!match)
> > 		   return NULL;
> >
> > 		match_data = (const void *)match->driver_data;
> > 	}
> >
> > 	return match_data;
> > }
> > EXPORT_SYMBOL(i2c_get_match_data);
> 
> Yes. Not good? I thought a function named 'i2c_get_match_data' should
> get match_data and find out itself where it is coming from. No?

Yes, It looks good to me based on your explanation.

Cheers,
Biju





[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux