-
SIMPLE_DEV_PM_OPS宏
SYSTEM_SLEEP_PM_OPS和dev_pm_ops的定义:- #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,
-
- struct dev_pm_ops {
- int (*prepare)(struct device *dev);
- void (*complete)(struct device *dev);
- int (*suspend)(struct device *dev);
- int (*resume)(struct device *dev);
- int (*freeze)(struct device *dev);
- int (*thaw)(struct device *dev);
- int (*poweroff)(struct device *dev);
- int (*restore)(struct device *dev);
- int (*suspend_noirq)(struct device *dev);
- int (*resume_noirq)(struct device *dev);
- int (*freeze_noirq)(struct device *dev);
- int (*thaw_noirq)(struct device *dev);
- int (*poweroff_noirq)(struct device *dev);
- int (*restore_noirq)(struct device *dev);
- int (*runtime_suspend)(struct device *dev);
- int (*runtime_resume)(struct device *dev);
- int (*runtime_idle)(struct device *dev);
- };
struct platform_driver中的driver成员也有一个dev_pm_ops- struct platform_driver {
- int (*probe)(struct platform_device *);
- int (*remove)(struct platform_device *);
- void (*shutdown)(struct platform_device *);
- int (*suspend)(struct platform_device *, pm_message_t state);
- int (*resume)(struct platform_device *);
- struct device_driver driver;
- const struct platform_device_id *id_table;
- };
-
- struct device_driver {
- const char *name;
- struct bus_type *bus;
-
- struct module *owner;
- const char *mod_name;
-
- bool suppress_bind_attrs;
-
- const struct of_device_id *of_match_table;
-
- int (*probe) (struct device *dev);
- int (*remove) (struct device *dev);
- void (*shutdown) (struct device *dev);
- int (*suspend) (struct device *dev, pm_message_t state);
- int (*resume) (struct device *dev);
- const struct attribute_group **groups;
-
- const struct dev_pm_ops *pm;
-
- struct driver_private *p;
- };
那么可以将宏SIMPLE_DEV_PM_OPS使用到struct platform_driver定义中,例如gpio-keys.c中:- static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume);
-
- static struct platform_driver gpio_keys_device_driver = {
- .probe = gpio_keys_probe,
- .remove = __devexit_p(gpio_keys_remove),
- .driver = {
- .name = "gpio-keys",
- .owner = THIS_MODULE,
- .pm = &gpio_keys_pm_ops,
- .of_match_table = gpio_keys_of_match,
- }
- };
-
相关阅读:
使用JAX-WS(JWS)发布WebService(一)
PING命令与ICMP协议
子网划分和无分类编址
谈谈网络分层和IP
hydra暴力破解ssh服务器密码
TCP报文解析
OSI七层协议与TCP连接
Java Native Interface调用C++代码
Java的序列化和反序列化
Java关于static的作用
-
原文地址:https://www.cnblogs.com/liang123/p/6325187.html
Copyright © 2020-2023
润新知