diff options
Diffstat (limited to 'include/linux/pm_wakeup.h')
-rw-r--r-- | include/linux/pm_wakeup.h | 48 |
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 | */ |
33 | static inline void device_init_wakeup(struct device *dev, int val) | 38 | static 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 | ||
38 | static inline void device_set_wakeup_capable(struct device *dev, int val) | 43 | static 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 | ||
43 | static inline int device_can_wakeup(struct device *dev) | 48 | static 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 | ||
48 | static inline void device_set_wakeup_enable(struct device *dev, int val) | 53 | static 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 | ||
53 | static inline int device_may_wakeup(struct device *dev) | 58 | static 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 */ |
61 | static inline void device_init_wakeup(struct device *dev, int val) | 66 | static 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 | ||
66 | static inline void device_set_wakeup_capable(struct device *dev, int val) { } | 71 | static inline void device_set_wakeup_capable(struct device *dev, bool capable) |
72 | { | ||
73 | dev->power.can_wakeup = capable; | ||
74 | } | ||
67 | 75 | ||
68 | static inline int device_can_wakeup(struct device *dev) | 76 | static 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) | 81 | static inline void device_set_wakeup_enable(struct device *dev, bool enable) |
74 | #define device_may_wakeup(dev) 0 | 82 | { |
83 | } | ||
84 | |||
85 | static 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 | ||