See "Understanding Linux Network Internals" 6.5 and "Documentation/driver-model/binding.txt" for the big picture.
Code path for device and driver binding(based on 2.6.38-rc6 source code).
pci_register_driver()/__pci_register_driver() => driver_register() => bus_add_driver() => driver_attach() => bus_for_each_dev() => __driver_attach() => driver_probe_device() => really_probe() => driver_bound()
In __driver_attach(), the match() function registered to pci bus will be invoked to check whether the driver matches the device. If so, driver_probe_device() will be invoked, which in turn invokes probe() function registered in bus or device driver. If probe() returns no error, driver_bound() will be invoked to bind the driver to the device.
TODO: How and when pci_register_driver() is called when a new pci device is hotplugged in?
References:
[KERNELSRC]/Documentation/driver-model/
阅读(1385) | 评论(0) | 转发(0) |