As I understood after reading the chapter related to The Linux Device Model in the Linux Device Drivers 3rd Edition, when a new device is configured, the kernel (2.6) follows more or less this sequence:
- The Device is registered in the driver core (
device_register()
, what includes device initialization) - A kobject is registered in the device model
- It creates an entry in sysfs and provokes a hotplug event
- Bus and drivers are checked to see which one matches with the device
- Probe
- Device is binded to the driver
My main doubt is, in step 1, when is device_register()
called and what fields should already be set in the device
struct?
Is it called by the bus to which the device is connected? Any example in the code?
Have I misunderstood anything? :)