pci dev notes

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值