i2c驱动程序(2) i2c_driver probe被调用的流程分析

(本文为个人的笔记 难免有错 望各位高人赐教指正 谢谢!)
i2c驱动程序i2c_driver probe被调用的流程分析
step1
i2c_add_driver(&at24_driver);
step2
i2c_register_driver(THIS_MODULE, driver)
step3
res = driver_register(&driver->driver);
step4
ret = bus_add_driver(drv);
step5
if (drv->bus->p->drivers_autoprobe) {
driver_attach(drv);
step6
driver_attach(struct device_driver *drv)
step7
bus_for_each_dev(drv->bus, NULL, drv, __driver_attach)
fn(dev, data);
step8
__driver_attach(dev, data);
step9
driver_match_device
step10
return drv->bus->match ? drv->bus->match(dev, drv) : 1;
调用总线的match匹配函数 .match = i2c_device_match,
step11
if (of_driver_match_device(dev, drv))
of_match_device(drv>of_match_table, dev) != NULL;
step12
of_match_node(matches, dev->of_node); __of_match_node(matches, node);
step13
if (matches->name[0]) match &= node->name&& !strcmp(matches->name, node->name);
if (matches->type[0])
match &= node->type&& !strcmp(matches->type, node->type);
if (matches->compatible[0])
match &= __of_device_is_compatible(node, matches->compatible);
step14
driver_probe_device
ret = really_probe(dev, drv);
step15
if (dev->bus->probe)
.probe = i2c_device_probe,
step16
struct i2c_driver *driver; status = driver->probe(client, i2c_match_id(driver->id_table, client));

猜你喜欢

转载自blog.csdn.net/u012855539/article/details/72860174
今日推荐