Introduction to LDM data structures
The Linux device model introduced device hierarchy. It is built on top of a few data structures. Among these is the bus, which is represented in the kernel as an instance of struct bus_type
; the device driver, which is represented by a struct device_driver
structure; and the device, which is the last element and is represented as an instance of the struct device
structure. In this section, we will introduce all those structures and learn how they interact each with other.
The bus data structure
A bus is a channel link between devices and the processor. The hardware entity that manages the bus and exports its protocol to devices is called the bus controller. For example, the USB controller provides USB support, while the I2C controller provides I2C bus support. However, the bus controller, being a device on its own, must be registered like any device. It will be the parent of the devices that need to sit on this bus. In other words, every device...