aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_wakeup.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pm_wakeup.h')
-rw-r--r--include/linux/pm_wakeup.h48
1 files changed, 31 insertions, 17 deletions
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 0aae7776185e..76aca48722ae 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -25,53 +25,67 @@
25# error "please don't include this file directly" 25# error "please don't include this file directly"
26#endif 26#endif
27 27
28#include <linux/types.h>
29
28#ifdef CONFIG_PM 30#ifdef CONFIG_PM
29 31
30/* changes to device_may_wakeup take effect on the next pm state change. 32/* Changes to device_may_wakeup take effect on the next pm state change.
31 * by default, devices should wakeup if they can. 33 *
34 * By default, most devices should leave wakeup disabled. The exceptions
35 * are devices that everyone expects to be wakeup sources: keyboards,
36 * power buttons, possibly network interfaces, etc.
32 */ 37 */
33static inline void device_init_wakeup(struct device *dev, int val) 38static inline void device_init_wakeup(struct device *dev, bool val)
34{ 39{
35 dev->power.can_wakeup = dev->power.should_wakeup = !!val; 40 dev->power.can_wakeup = dev->power.should_wakeup = val;
36} 41}
37 42
38static inline void device_set_wakeup_capable(struct device *dev, int val) 43static inline void device_set_wakeup_capable(struct device *dev, bool capable)
39{ 44{
40 dev->power.can_wakeup = !!val; 45 dev->power.can_wakeup = capable;
41} 46}
42 47
43static inline int device_can_wakeup(struct device *dev) 48static inline bool device_can_wakeup(struct device *dev)
44{ 49{
45 return dev->power.can_wakeup; 50 return dev->power.can_wakeup;
46} 51}
47 52
48static inline void device_set_wakeup_enable(struct device *dev, int val) 53static inline void device_set_wakeup_enable(struct device *dev, bool enable)
49{ 54{
50 dev->power.should_wakeup = !!val; 55 dev->power.should_wakeup = enable;
51} 56}
52 57
53static inline int device_may_wakeup(struct device *dev) 58static inline bool device_may_wakeup(struct device *dev)
54{ 59{
55 return dev->power.can_wakeup && dev->power.should_wakeup; 60 return dev->power.can_wakeup && dev->power.should_wakeup;
56} 61}
57 62
58#else /* !CONFIG_PM */ 63#else /* !CONFIG_PM */
59 64
60/* For some reason the next two routines work even without CONFIG_PM */ 65/* For some reason the following routines work even without CONFIG_PM */
61static inline void device_init_wakeup(struct device *dev, int val) 66static inline void device_init_wakeup(struct device *dev, bool val)
62{ 67{
63 dev->power.can_wakeup = !!val; 68 dev->power.can_wakeup = val;
64} 69}
65 70
66static inline void device_set_wakeup_capable(struct device *dev, int val) { } 71static inline void device_set_wakeup_capable(struct device *dev, bool capable)
72{
73 dev->power.can_wakeup = capable;
74}
67 75
68static inline int device_can_wakeup(struct device *dev) 76static inline bool device_can_wakeup(struct device *dev)
69{ 77{
70 return dev->power.can_wakeup; 78 return dev->power.can_wakeup;
71} 79}
72 80
73#define device_set_wakeup_enable(dev, val) do {} while (0) 81static inline void device_set_wakeup_enable(struct device *dev, bool enable)
74#define device_may_wakeup(dev) 0 82{
83}
84
85static inline bool device_may_wakeup(struct device *dev)
86{
87 return false;
88}
75 89
76#endif /* !CONFIG_PM */ 90#endif /* !CONFIG_PM */
77 91