*参照元 [#rb13ac8f] #backlinks *説明 [#t9f062cd] -パス: [[linux-2.6.33/drivers/base/dd.c]] -FIXME: これは何? --説明 **引数 [#l791df52] -struct device *dev -- --[[linux-2.6.33/device]] -struct device_driver *drv -- --[[linux-2.6.33/device_driver]] **返り値 [#waa275c4] -int -- **参考 [#fb10730d] *実装 [#s7bbe6b6] static int really_probe(struct device *dev, struct device_driver *drv) { int ret = 0; atomic_inc(&probe_count); - --[[linux-2.6.33/atomic_inc()]] pr_debug("bus: '%s': %s: probing driver %s with device %s\n", drv->bus->name, __func__, drv->name, dev_name(dev)); - --[[linux-2.6.33/pr_debug()]] --[[linux-2.6.33/dev_name()]] -drv->bus は struct bus_type 型である。 --[[linux-2.6.33/bus_type]] WARN_ON(!list_empty(&dev->devres_head)); - --[[linux-2.6.33/WARN_ON()]] --[[linux-2.6.33/list_empty()]] dev->driver = drv; if (driver_sysfs_add(dev)) { printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", __func__, dev_name(dev)); goto probe_failed; } - --[[linux-2.6.33/driver_sysfs_add()]] --[[linux-2.6.33/printk()]] 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; -バスのプローブ関数がなければ、 ドライバのプローブ関数をチェックし、あれば呼び出す。 } driver_bound(dev); - --[[linux-2.6.33/driver_bound()]] ret = 1; pr_debug("bus: '%s': %s: bound device %s to driver %s\n", drv->bus->name, __func__, dev_name(dev), drv->name); goto done; probe_failed: devres_release_all(dev); - --[[linux-2.6.33/devres_release_all()]] driver_sysfs_remove(dev); - --[[linux-2.6.33/driver_sysfs_remove()]] dev->driver = NULL; if (ret != -ENODEV && ret != -ENXIO) { /* driver matched but the probe failed */ printk(KERN_WARNING "%s: probe of %s failed with error %d\n", drv->name, dev_name(dev), ret); } /* * Ignore errors returned by ->probe so that the next driver can try * its luck. */ ret = 0; done: atomic_dec(&probe_count); - --[[linux-2.6.33/atomic_dec()]] wake_up(&probe_waitqueue); - --[[linux-2.6.33/wake_up()]] return ret; } *コメント [#qe806a16]