1. drivers/pci/probe.c
pci_device_add()-> pci_init_capabilities()-> pci_pm_init()-> pm_runtime_forbid(), which will add the dev->power.usage_count
2. driver_probe_device()-> pci_device_probe()-> __pci_device_probe()-> pci_call_probe()-> local_pci_probe()-> pm_runtime_get_noresume()/pm_runtime_set_active()/pm_runtime_enable()
so based on above two items, in specific pci device driver, it needs to use pm_runtime_put_noidel() and pm_runtime_allow() in probe() to enable runtime.
3. you can run: grep -rn "runtime" drivers/base, then you will find that pm_runtime_get_noresume() and pm_runtime_put_sync() will be called before and after really_probe() separately in driver_probe_device().
4. driver/pci/pci-driver.c
pci_pm_runtime_suspend()-> pci_finish_runtime_suspend()->pci_set_power_state()-> ... ->platform_pci_set_power_state()-> drivers/pci/intel_soc_pci.c:pmu_pci_set_power_state() <<= arch/x86/platform/intel-mid/intel_soc_pmu.c
5. arch/x86/pci/*.c
6. the code for remove/add a PCI device:
only the enumeration of booting and hotplug will cause the PCI device add/remove,
add a PCI device:
pci_scan_slot()-> pci_scan_single_device()-> pci_scan_device()-> pci_device_add()
remove a PCI device:
pci_remove_bus_device()-> pci_destroy_dev()-> pci_stop_dev()-> device_unregister()-> device_del()-> bus_remove_device()-> device_release_driver()-> __device_release_driver
阅读(1734) | 评论(0) | 转发(0) |