dpm_list链表
2016-09-24 21:50
99 查看
dpm_list是内核中用于设备电源管理的链表,设备注册时通过一系列的调用 device_register() -> device_add() -> device_pm_add() 最后在device_pm_add()中将设备加入dpm_list链表中:
[cpp]
view plain
copy
print?
// 设备创建时都会调用的函数,将设备加入dpm_list链表
void device_pm_add(struct device *dev)
{
pr_debug("PM: Adding info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus",
kobject_name(&dev->kobj));
mutex_lock(&dpm_list_mtx);
if (dev->parent) {
if (dev->parent->power.status >= DPM_SUSPENDING)
dev_warn(dev, "parent %s should not be sleeping\n",
dev_name(dev->parent));
} else if (transition_started) {
/*
* We refuse to register parentless devices while a PM
* transition is in progress in order to avoid leaving them
* unhandled down the road
*/
dev_WARN(dev, "Parentless device registered during a PM transaction\n");
}
// 将设备节点添加到链表尾部,即设备按注册的先后顺序从链表头部到尾部
list_add_tail(&dev->power.entry, &dpm_list);
mutex_unlock(&dpm_list_mtx);
}
![](http://static.blog.csdn.net/images/save_snippets.png)
而设备注销的时候会调用device_pm_remove()将设备从dpm_list链表中移除:
[cpp]
view plain
copy
print?
// 设备注销时都会调用的函数,将设备从dpm_list链表中移除
void device_pm_remove(struct device *dev)
{
pr_debug("PM: Removing info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus",
kobject_name(&dev->kobj));
mutex_lock(&dpm_list_mtx);
list_del_init(&dev->power.entry);
mutex_unlock(&dpm_list_mtx);
pm_runtime_remove(dev);
}
dpm_list是内核中用于设备电源管理的链表,设备注册时通过一系列的调用 device_register() -> device_add() -> device_pm_add() 最后在device_pm_add()中将设备加入dpm_list链表中:
[cpp]
view plain
copy
print?
// 设备创建时都会调用的函数,将设备加入dpm_list链表
void device_pm_add(struct device *dev)
{
pr_debug("PM: Adding info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus",
kobject_name(&dev->kobj));
mutex_lock(&dpm_list_mtx);
if (dev->parent) {
if (dev->parent->power.status >= DPM_SUSPENDING)
dev_warn(dev, "parent %s should not be sleeping\n",
dev_name(dev->parent));
} else if (transition_started) {
/*
* We refuse to register parentless devices while a PM
* transition is in progress in order to avoid leaving them
* unhandled down the road
*/
dev_WARN(dev, "Parentless device registered during a PM transaction\n");
}
// 将设备节点添加到链表尾部,即设备按注册的先后顺序从链表头部到尾部
list_add_tail(&dev->power.entry, &dpm_list);
mutex_unlock(&dpm_list_mtx);
}
![](http://static.blog.csdn.net/images/save_snippets.png)
// 设备创建时都会调用的函数,将设备加入dpm_list链表 void device_pm_add(struct device *dev) { pr_debug("PM: Adding info for %s:%s\n", dev->bus ? dev->bus->name : "No Bus", kobject_name(&dev->kobj)); mutex_lock(&dpm_list_mtx); if (dev->parent) { if (dev->parent->power.status >= DPM_SUSPENDING) dev_warn(dev, "parent %s should not be sleeping\n", dev_name(dev->parent)); } else if (transition_started) { /* * We refuse to register parentless devices while a PM * transition is in progress in order to avoid leaving them * unhandled down the road */ dev_WARN(dev, "Parentless device registered during a PM transaction\n"); } // 将设备节点添加到链表尾部,即设备按注册的先后顺序从链表头部到尾部 list_add_tail(&dev->power.entry, &dpm_list); mutex_unlock(&dpm_list_mtx); }
而设备注销的时候会调用device_pm_remove()将设备从dpm_list链表中移除:
[cpp]
view plain
copy
print?
// 设备注销时都会调用的函数,将设备从dpm_list链表中移除
void device_pm_remove(struct device *dev)
{
pr_debug("PM: Removing info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus",
kobject_name(&dev->kobj));
mutex_lock(&dpm_list_mtx);
list_del_init(&dev->power.entry);
mutex_unlock(&dpm_list_mtx);
pm_runtime_remove(dev);
}
相关文章推荐
- DPM演示录像
- DPM 2010 Documentation
- 关于DPM自动发现
- 关于DPM的安装使用、备份和还原测试
- list链表
- 在Windows server 2012上部署DPM 2012 SP1 RTM之先决条件准备 推荐
- VMware vSphere 5.1 群集深入解析(十六)-DPM介绍
- DPM 2012 SP1---恢复Exchange2013单用户邮箱 推荐
- DPM(Defomable Parts Model) 源码分析
- DPM(Deformable Parts Model)--原理(一)
- DPM中的HOG源码的Matlab版重写-《小超教你写论文》系列第四部分第一篇
- 快速搞定DPM 2012 R2 Powershell cmdlet 推荐
- Windows环境运行DPM(Discriminatively Trained Deformable Part Models)V3.1_Demo
- 在Windows Server 2012 R2上全新部署DPM 2012 R2
- DPM目标检测-1
- 使用DPM训练自己的模型
- DPM--对象检测开山之作
- 24 dpm_drv_timeout()和dpm_wd_handler()一样,请参考《BUG at dpm_wd_handler》章节
- 用DPM训练自己的模型,并用于视频检测
- RCNN,Fast-RCNN,Faster-RCNN,SSD,DPM检测框架