Device Model for Linux drivers (8)

Source: Internet
Author: User

9. Summary

Relationship between 9.1 bus, device, driver and class

L bus is equivalent to a container. It is the management mechanism of device and device_driver. It contains a device set (devices_kset) and a driver set (drivers_kset ), indicates all devices attached to the bus and all drivers.

L The driver is attached to the bus and contains a device chain (klist_devices) used to traverse the devices on the bus. The driver also contains a bus_type pointer, indicating the bus to which the driver is attached.

L The device Mount bus contains a device_driver pointer, indicating the device driver of the device. It also contains bus_type, indicating the bus to which the device is attached

L class is classified according to the functions of devices. devices with the same functions are classified into one type, and bus with the same functions (the actual bus is also a device) may also be classified.

L it should be noted that an actual bus is represented by two structures in the device model: bus_type and device. bus_type represents the bus type and appears in the/sys/bus/directory; device indicates a bus device that appears in the/sys/devices/directory. This indicates that the actual bus is essentially a device. device and device_driver are usually embedded in other data structures, not used separately.

 

9.2 instance relationship

Is the diagram drawn from the above experiments

You can download the instance source code through git: git clone git: // github.com/cjok/device-model.git

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.