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

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

 



> 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?

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux