详解Linux2.6内核中基于platform机制的驱动模型 (经典) (8)


272/**
 273 * driver_attach - try to bind driver to devices.
 274 * @drv: driver.
 275 *
 276 * Walk the list of devices that the bus has on it and try to
 277 * match the driver with each one.  If driver_probe_device()
 278 * returns 0 and the @dev->driver is set, we\'ve found a
 279 * compatible pair.
 280 */
 281int driver_attach(struct device_driver *drv)
 282{
 283        return bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);
 284}
 285EXPORT_SYMBOL_GPL(driver_attach);

扫描该总线上的每一个设备,将当前driver和总线上的设备进行match,如果匹配成功,则将设备和driver绑定起来。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwjjds.html