The registration process of Linux Device and driver and the timing of Probe

Source: Internet
Author: User

Tian haili @ csdn

2011/08/26

 

In the device driver model of Linux 2.6, all devices are connected by bus. When device_register ()/driver_register () is executed, the driver/device on the enumeration bus is used for binding. This article describes this process. This is the basis for the entire Linux device driver. The registration of platform devices, I2C devices, and other devices is also implemented by calling the registration function described in this article.

 

The registration of Linux device is ultimately implemented through device_register (), and the registration of driver is ultimately implemented through driver_register. The registration process of device and driver is described in comparison.

 

The diagram above is clear at a glance, and the detailed process will not be repeated. Note the following:

    • Bus p-> drivers_autoprobe; 1 is true by default.
    • Bus_for_each_drv () performs the _ device_attach () operation on all drivers on the bus. Similarly, bus_for_each_dev () performs the _ driver_attach () operation on all devices on the bus () operation.
    • The. Match () function implemented on the bus defines the rules when device and driver are bound. For example, platform compares id_table and name rules first. If the bus match () function is not implemented, it is considered that all the devices and drivers on the bus are matched. The specific subsequent process depends on the implementation of probe.
    • The probe rule is: If probe is implemented on the bus, the probe of the bus will be used; otherwise, the probe of the driver will be used.

 

Device is generally registered prior to the driver, but not all in this order. During the registration process of device and driver in Linux, all drivers and devices mounted on the bus are enumerated respectively to achieve this time series independence.

*** Welcome to reprint, and please indicate the original from http://blog.csdn.net/thl789/article/details/6723350 ***

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.