通过SIMPLE_DEV_PM_OPS定义suspend和resume函数【转】
本文转载自:https://blog.csdn.net/tiantao2012/article/details/77851782
通过SIMPLE_DEV_PM_OPS 定义这个驱动的suspend和resume函数,如果没有定义CONFIG_PM_SLEEP的时候就将CONFIG_PM_SLEEP定义为空函数,这样可以避免build error
static SIMPLE_DEV_PM_OPS(asic3_led_pm_ops, asic3_led_suspend, asic3_led_resume);
static struct platform_driver asic3_led_driver = {
.probe = asic3_led_probe,
.remove = asic3_led_remove,
.driver = {
.name = "leds-asic3",
.pm = &asic3_led_pm_ops,
},
};
SIMPLE_DEV_PM_OPS 定义如下:
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
const struct dev_pm_ops name = { \
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
}
如果定义CONFIG_PM_SLEEP的话,就给suspend和resume的函数指针赋值
#ifdef CONFIG_PM_SLEEP
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
.suspend = suspend_fn, \
.resume = resume_fn, \
.freeze = suspend_fn, \
.thaw = resume_fn, \
.poweroff = suspend_fn, \
.restore = resume_fn,
#else
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#endif
可以看到如果没有定义CONFIG_PM_SLEEP的话,SIMPLE_DEV_PM_OPS 就相当于空函数
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
const struct dev_pm_ops name = { \
---------------------
作者:tiantao2012
来源:CSDN
原文:https://blog.csdn.net/tiantao2012/article/details/77851782
版权声明:本文为博主原创文章,转载请附上博文链接!
通过SIMPLE_DEV_PM_OPS定义suspend和resume函数【转】的更多相关文章
- Linux的系统suspend和resume
参考: www.wowotech.net/linux_kenrel/suspend_and_resume.htmlwww.wowotech.net/linux_kenrel/pm_interface. ...
- (十二)Linux Kernel suspend and resume
一.对于休眠(suspend)的简单介绍 在Linux中,休眠主要分三个主要的步骤: 1) 冻结用户态进程和内核态任务 2) 调用注册的设备的suspend的回调函数, 顺序是按照注册顺序 ...
- Java中的线程Thread方法之---suspend()和resume()
前篇说到了Thread中的join方法,这一篇我们就来介绍一下suspend()和resume()方法,从字面意义上可以了解到这两个方法是一对的,suspend()方法就是将一个线程挂起(暂停),re ...
- 被废弃的 Thread.stop, Thread.suspend, Thread.resume 和Runtime.runFinalizersOnExit
最近学习多线程的知识,看到API里说这些方法被废弃了,就查了一下原因 Thread.stop 这个方法会解除被加锁的对象的锁,因而可能造成这些对象处于不一致的状态,而且这个方法造成的ThreadDea ...
- Don’t use Suspend and Resume, but don’t poll either.
http://www.paradicesoftware.com/blog/2014/02/dont-use-suspend-and-resume-but-dont-poll-either/ Don’t ...
- C语言利用va_list、va_start、va_end、va_arg宏定义可变参数的函数
在定义可变参数的函数之前,先来理解一下函数参数的传递原理: 1.函数参数是以栈这种数据结构来存取的,在函数参数列表中,从右至左依次入栈. 2.参数的内存存放格式:参数的内存地址存放在内存的堆栈段中,在 ...
- c 可变参数 定义可变参数的函数
定义可变参数的函数,需要在stdarg.h头文件中定义的va_list类型和va_start.va_arg.va_end三个宏. 定义可变参数函数 va_list ap; //实际是定义一个指针va ...
- JAVA多线程suspend()、resume()和wait()、notify()的区别
suspend() 和 resume() 方法:两个方法配套使用,suspend()使得线程进入阻塞状态,并且不会自动恢复,必须其对应的 resume() 被调用,才能使得线程重新进入可执行状态.典型 ...
- Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated ?
Thread.stop, Thread.suspend, Thread.resume被标记为废弃的方法.在查看JDK的文档时,提到了下面的参考文章,先是英文版,接着是中文翻译. Why is Thre ...
随机推荐
- sql server行列转化和行列置换
行列转换: 姓名 课程 分数 张三 语文 74 张三 数学 83 张三 物理 93 李四 语文 74 李四 数学 84 李四 物理 94 想变成(得到如下结果): 姓名 语文 数学 物理 ---- - ...
- mysql 5.6 每天凌晨12:00 重置sequence表中的某个值
#.创建evevt要调用的存储过程update_current_value_procedure delimiter // drop procedure if exists update_current ...
- JSP知识点
1.九大内置对象: request HttpServletRequest类的实例 response HttpServletResponse类的实例 out PrintWriter类的实例,用于把结果输 ...
- U盘自动拷贝
描述:启动该程序后,自动检测U盘是否存在,若存在,将U盘中所有的文件拷贝到电脑的指定目录下. 注:本篇博文仅支持技术讨论,不用于数据的盗取之类的黑科技. 本程序基于Win32开发,主要是利用Win32 ...
- STL之List容器
1.List容器 1) list是一个双向链表容器,可高效地进行插入删除元素. 2)list不可以随机存取元素,所以不支持at.(pos)函数与[]操作符.It++(ok) it+5(err) 3)头 ...
- GCD(III)
GCD 线程间的通信 在iOS开发过程中,我们一般在主线程里边进行UI刷新,例如:点击.滚动.拖拽等事件.我们通常把一些耗时的操作放在其他线程,比如说图片下载.文件上传等耗时操作.而当我们有时候在其他 ...
- ReactiveObjC
简介: RAC 指的就是 RactiveCocoa ,是 Github 的一个开源框架,能够帮我们提供大量方便的事件处理方案,让我们更简单粗暴地去处理事件,现在分为 ReactiveObjC 和 Re ...
- freedom is a kind of responsibility
张维迎教授在2017年7月1日北大国发院2017届毕业典礼上的发言<自由是一种责任> 张维迎:自由是一种责任 本文为张维迎教授在2017年7月1日北大国发院2017届毕业典礼上的发言 ...
- xlrd、xlwt
一个公司内,销售或者人事都是使用excel来记录员工的信息,所以介绍可操作excel文件的xlrd.xlwt模块. 其中xlrd模块实现对excel文件内容读取,xlwt模块实现对excel文件的写入 ...
- Locust 分布式测试
转:http://www.testclass.net/locust/distributed/ 参考:官方文档 分布式运行Locust 一旦单台机器不够模拟足够多的用户时,Locust支持运行在多台机器 ...