/*****************************************************************************************************************************************
*Author:JYW
*Time:2019_06_04
*Describe:学而记之进而习之
***************************************************************/
IIC子系统开发之核心层分析
/*注册一根IIC总线*/
retval = bus_register(&i2c_bus_type);
.match = i2c_device_match,//匹配函数
static int i2c_device_match(struct device *dev, struct device_driver *drv)
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_driver *driver = to_i2c_driver(drv);
/* make legacy i2c drivers bypass driver model probing entirely;
* such drivers scan each i2c adapter/bus themselves.
*/
if (!is_newstyle_driver(driver))
return 0;
/* match on an id table if there is one */
if (driver->id_table)
return i2c_match_id(driver->id_table, client) != NULL;
return 0;
}