4,438
社区成员
发帖
与我相关
我的任务
分享
//调用的层次比较多 就不贴全代码了 怎么调到really_probe 自己查吧
static int really_probe(struct device *dev, struct device_driver *drv)//从这里开始
{
if (dev->bus->probe) {
ret = dev->bus->probe(dev);
if (ret)
goto probe_failed;
} else if (drv->probe) {
ret = drv->probe(dev);
if (ret)
goto probe_failed;
}
}
-------------------------
int of_bus_type_init(struct bus_type *bus, const char *name)
{
bus->name = name;
bus->match = of_platform_bus_match;
bus->probe = of_platform_device_probe;
bus->remove = of_platform_device_remove;
bus->shutdown = of_platform_device_shutdown;
bus->dev_attrs = of_platform_device_attrs;
bus->pm = OF_PLATFORM_PM_OPS_PTR;
return bus_register(bus);
}
----------------------------------
static int of_platform_device_probe(struct device *dev)
{
int error = -ENODEV;
struct of_platform_driver *drv;
struct of_device *of_dev;
const struct of_device_id *match;
drv = to_of_platform_driver(dev->driver);//这里得到of_platform_driver
of_dev = to_of_device(dev);
if (!drv->probe)
return error;
of_dev_get(of_dev);
match = of_match_device(drv->match_table, of_dev);
if (match)
error = drv->probe(of_dev, match);//这里probe调用
if (error)
of_dev_put(of_dev);
return error;
}