Difference between device_register and driver_register

后端 未结 2 1060
夕颜
夕颜 2020-12-17 06:27

I am writing a UART driver. I came across the two functions in the chapter 14.Linux Device Model.

int device_register(struct device *dev);
int driver_registe         


        
相关标签:
2条回答
  • 2020-12-17 07:03

    @Dino, as per my understanding device_register: is nothing but registering a new device to the system and link which you can go through https://www.kernel.org/doc/htmldocs/device-drivers/API-device-register.html. driver_register: registering a platform driver, this driver supports devices based on the ".name" and ".of_match_table" specified in the platform driver structure. ".name" in structure platform_driver and name in the platform_device should match then only device gets bind to driver and probe function is called. Please go through the link http://lwn.net/Articles/448499/

    0 讨论(0)
  • 2020-12-17 07:07

    driver_register: Adds this driver to the bus' list of drivers.

    device_register: Bus' list of drivers is iterated to find the driver that supports this device and then this device is added to the bus' list of devices.

    0 讨论(0)
提交回复
热议问题