SYSTEM_SLEEP_PM_OPS和dev_pm_ops的定义:

[cpp] view plain copy

  1. #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
  2. .suspend = suspend_fn, \
  3. .resume = resume_fn, \
  4. .freeze = suspend_fn, \
  5. .thaw = resume_fn, \
  6. .poweroff = suspend_fn, \
  7. .restore = resume_fn,
  8. struct dev_pm_ops {
  9. int (*prepare)(struct device *dev);
  10. void (*complete)(struct device *dev);
  11. int (*suspend)(struct device *dev);
  12. int (*resume)(struct device *dev);
  13. int (*freeze)(struct device *dev);
  14. int (*thaw)(struct device *dev);
  15. int (*poweroff)(struct device *dev);
  16. int (*restore)(struct device *dev);
  17. int (*suspend_noirq)(struct device *dev);
  18. int (*resume_noirq)(struct device *dev);
  19. int (*freeze_noirq)(struct device *dev);
  20. int (*thaw_noirq)(struct device *dev);
  21. int (*poweroff_noirq)(struct device *dev);
  22. int (*restore_noirq)(struct device *dev);
  23. int (*runtime_suspend)(struct device *dev);
  24. int (*runtime_resume)(struct device *dev);
  25. int (*runtime_idle)(struct device *dev);
  26. };

struct platform_driver中的driver成员也有一个dev_pm_ops

[cpp] view plain copy

  1. struct platform_driver {
  2. int (*probe)(struct platform_device *);
  3. int (*remove)(struct platform_device *);
  4. void (*shutdown)(struct platform_device *);
  5. int (*suspend)(struct platform_device *, pm_message_t state);
  6. int (*resume)(struct platform_device *);
  7. struct device_driver driver;
  8. const struct platform_device_id *id_table;
  9. };
  10. struct device_driver {
  11. const char      *name;
  12. struct bus_type     *bus;
  13. struct module       *owner;
  14. const char      *mod_name;  /* used for built-in modules */
  15. bool suppress_bind_attrs;   /* disables bind/unbind via sysfs */
  16. const struct of_device_id   *of_match_table;
  17. int (*probe) (struct device *dev);
  18. int (*remove) (struct device *dev);
  19. void (*shutdown) (struct device *dev);
  20. int (*suspend) (struct device *dev, pm_message_t state);
  21. int (*resume) (struct device *dev);
  22. const struct attribute_group **groups;
  23. const struct dev_pm_ops *pm;
  24. struct driver_private *p;
  25. };

那么可以将宏SIMPLE_DEV_PM_OPS使用到struct platform_driver定义中,例如gpio-keys.c中:

[cpp] view plain copy

  1. static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume);
  2. static struct platform_driver gpio_keys_device_driver = {
  3. .probe      = gpio_keys_probe,
  4. .remove     = __devexit_p(gpio_keys_remove),
  5. .driver     = {
  6. .name   = "gpio-keys",
  7. .owner  = THIS_MODULE,
  8. .pm = &gpio_keys_pm_ops,
  9. .of_match_table = gpio_keys_of_match,
  10. }
  11. };

SIMPLE_DEV_PM_OPS宏的更多相关文章

  1. 1.Linux电源管理-休眠与唤醒

    1.休眠方式 在内核中,休眠方式有很多种,可以通过下面命令查看 # cat /sys/power/state //来得到内核支持哪几种休眠方式. 常用的休眠方式有freeze,standby, mem ...

  2. 1.Linux电源管理-休眠与唤醒【转】

    转自:https://www.cnblogs.com/lifexy/p/9629699.html 1.休眠方式 在内核中,休眠方式有很多种,可以通过下面命令查看 # cat /sys/power/st ...

  3. Visual Studio 宏的高级用法

    因为自 Visual Studio 2012 开始,微软已经取消了对宏的支持,所以本篇文章所述内容只适用于 Visual Studio 2010 或更早期版本的 VS. 在上一篇中,我已经介绍了如何编 ...

  4. VC 中与字符串相关的宏 _T、TEXT,_TEXT、L 的作用

    CSDN原博文:http://blog.csdn.net/houkai363/article/details/8134787 遇到了:不能将参数 1 从“const char [5]”转换为“LPCT ...

  5. 【转】linux内核中writesb(), writesw(), writesl() 宏函数

    writesb(), writesw(), writesl() 宏函数 功能 : writesb()    I/O 上写入 8 位数据流数据 (1字节) writesw()   I/O  上写入 16 ...

  6. c++宏定义命令

    在程序开始以#开头的命令,他们是预编译命令.有三类预编译命令:宏定义命令.文件包含命令.条件编译命令:今天聊聊宏定义: 宏定义命令将一个标识符定义为一个字符串,源程序中的该标识符均以指定的字符串来代替 ...

  7. dll导入导出宏定义,出现“不允许 dllimport 函数 的定义”的问题分析

    建立dll项目后,在头文件中,定义API宏 #ifndef API_S_H #define API_S_H ...... #ifndef DLL_S_20160424 #define API _dec ...

  8. VC++/MFC 最常用宏和指令

    1.#include指令  包含指定的文件,最基本的最熟悉的指令,编程中不得不用,包含库文件用双尖括号,包含自定义头文件用双引号. 2.#define指令   预定义,通常用它来定义常量(包括无参量与 ...

  9. [Sass]混合宏的参数

    [Sass]混合宏的参数--传一个不带值的参数 Sass 的混合宏有一个强大的功能,可以传参,那么在 Sass 中传参主要有以下几种情形: A) 传一个不带值的参数 在混合宏中,可以传一个不带任何值的 ...

随机推荐

  1. mysql的连接处理过程

      在mysqld_main函数中经过一系列的初始化后,mysql开始监听客户端的连接 mysqld_socket_acceptor->connection_event_loop(); 查看my ...

  2. python day3_liaoxuefeng

    1.Python的循环有两种,一种是for...in循环,依次把list或tuple中的每个元素迭代出来,看例子: names = ['Michael', 'Bob', 'Tracy'] for na ...

  3. Python IDLE背景主题

    相信刚进入python学习之路的朋友们,都还是挺喜欢python自带的IDLE,但是白的代码背景色以及其它的代码色确实让人看着有点不舒服,所以当时也琢磨着能不能自己给它换换颜色,这个当然可以,废话不多 ...

  4. USB_ESD处理

    今天收到客户反馈说碰到USB后机器会死机,之前一直没有关注ESD问题. 现在整理之前用过的成熟的ESD电路: 电感为 PZ3216D101-3R0TF,1206封装. 用ESD枪测试OK, 用打火机持 ...

  5. 移动端开发,文字增加,字体自动放大(font boosting)

    问题缘由:做文章详情页的时候,文字多了一点字体就放大了,真的是奇了怪了. 问题重现 一段文字的时候 两段文字的时候 很明显,字体放大了很多. 疑点 meta标签缩放的问题 最近正好遇到处理retain ...

  6. h5的localStorage和sessionStorage

    今天做了个首页的弹窗,要求是打开时显示弹窗,然后点击关闭按钮时弹窗关闭,然后点击不再显示,之后再刷新就不会有弹窗,总结一下需求. 1.弹窗显示隐藏 这个很容易,我们可以用display:none和di ...

  7. Kafka(转载)

    Kafka是由LinkedIn开发的一个分布式的消息系统,使用Scala编写,它以可水平扩展和高吞吐率而被广泛使用.目前越来越多的开源分布式处理系统如Cloudera.Apache Storm.Spa ...

  8. python中的printf:%号拼接字符串和format函数

    在C语言中,我们使用printf("%s","hello")这种形式进行字符串的拼接 在python中,进行这样的拼接有两种实现方式,分别是%号拼接以及使用fo ...

  9. JDBC:从原理到应用

    一.是为何物 1.概念 JDBC(Java Data Base Connectivity,java数据库连接)是一种用于执行SQL语句的Java API,可以为多种关系数据库提供统一访问,它由一组用J ...

  10. Python OptionParser 使用详解(转载)

    Python使用命令行参数能使处理流程更自动化. 链接的内容讲解得十分详细:https://www.tuicool.com/articles/rUvIbi