Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2304006
  • 博文数量: 318
  • 博客积分: 8752
  • 博客等级: 中将
  • 技术积分: 4944
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-23 07:56
文章分类

全部博文(318)

文章存档

2019年(1)

2017年(2)

2016年(12)

2015年(2)

2014年(1)

2013年(17)

2012年(22)

2011年(9)

2010年(37)

2009年(33)

2008年(44)

2007年(43)

2006年(95)

分类: LINUX

2012-11-13 15:27:33

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) |
给主人留下些什么吧!~~