Linux Kernel设备驱动模型之绑定驱动到设备

    xiaoxiao2021-03-25  95

    /**  * device_bind_driver - bind a driver to one device.  * @dev: device.  *  * Allow manual attachment of a driver to a device.  * Caller must have already set @dev->driver.  *  * Note that this does not modify the bus reference count  * nor take the bus's rwsem. Please verify those are accounted  * for before calling this. (It is ok to call with no other effort  * from a driver's probe() method.)  *  * This function must be called with the device lock held.  */ int device_bind_driver(struct device *dev) {  int ret;

     ret = driver_sysfs_add(dev);  if (!ret)   driver_bound(dev);  else if (dev->bus)   blocking_notifier_call_chain(&dev->bus->p->bus_notifier,           BUS_NOTIFY_DRIVER_NOT_BOUND, dev);  return ret; }

           
    转载请注明原文地址: https://ju.6miu.com/read-15715.html

    最新回复(0)