diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-15 16:44:41 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-05-10 17:08:15 -0400 |
commit | 228c54ef7a028d5a4b6606eb0c8035874d9b6788 (patch) | |
tree | 3d8cd4ab882d3a4339e64a60ba597250a0971bf2 | |
parent | 94b849aaf6e22ab7bf54b0d0377a882d4892396d (diff) |
PM: pm_wakeup - switch to using bool
Also change couple of stubs implemented as macros in !CONFIG_PM case
in statinc inline functions to provide proper typechecking of
arguments regardless of config.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r-- | include/linux/pm_wakeup.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 0aae7776185e..22d64c18056c 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
@@ -25,32 +25,34 @@ | |||
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 | * by default, devices should wakeup if they can. |
32 | */ | 34 | */ |
33 | static inline void device_init_wakeup(struct device *dev, int val) | 35 | static inline void device_init_wakeup(struct device *dev, bool val) |
34 | { | 36 | { |
35 | dev->power.can_wakeup = dev->power.should_wakeup = !!val; | 37 | dev->power.can_wakeup = dev->power.should_wakeup = val; |
36 | } | 38 | } |
37 | 39 | ||
38 | static inline void device_set_wakeup_capable(struct device *dev, int val) | 40 | static inline void device_set_wakeup_capable(struct device *dev, bool capable) |
39 | { | 41 | { |
40 | dev->power.can_wakeup = !!val; | 42 | dev->power.can_wakeup = capable; |
41 | } | 43 | } |
42 | 44 | ||
43 | static inline int device_can_wakeup(struct device *dev) | 45 | static inline bool device_can_wakeup(struct device *dev) |
44 | { | 46 | { |
45 | return dev->power.can_wakeup; | 47 | return dev->power.can_wakeup; |
46 | } | 48 | } |
47 | 49 | ||
48 | static inline void device_set_wakeup_enable(struct device *dev, int val) | 50 | static inline void device_set_wakeup_enable(struct device *dev, bool enable) |
49 | { | 51 | { |
50 | dev->power.should_wakeup = !!val; | 52 | dev->power.should_wakeup = enable; |
51 | } | 53 | } |
52 | 54 | ||
53 | static inline int device_may_wakeup(struct device *dev) | 55 | static inline bool device_may_wakeup(struct device *dev) |
54 | { | 56 | { |
55 | return dev->power.can_wakeup && dev->power.should_wakeup; | 57 | return dev->power.can_wakeup && dev->power.should_wakeup; |
56 | } | 58 | } |
@@ -58,20 +60,28 @@ static inline int device_may_wakeup(struct device *dev) | |||
58 | #else /* !CONFIG_PM */ | 60 | #else /* !CONFIG_PM */ |
59 | 61 | ||
60 | /* For some reason the next two routines work even without CONFIG_PM */ | 62 | /* For some reason the next two routines work even without CONFIG_PM */ |
61 | static inline void device_init_wakeup(struct device *dev, int val) | 63 | static inline void device_init_wakeup(struct device *dev, bool val) |
62 | { | 64 | { |
63 | dev->power.can_wakeup = !!val; | 65 | dev->power.can_wakeup = val; |
64 | } | 66 | } |
65 | 67 | ||
66 | static inline void device_set_wakeup_capable(struct device *dev, int val) { } | 68 | static inline void device_set_wakeup_capable(struct device *dev, bool capable) |
69 | { | ||
70 | } | ||
67 | 71 | ||
68 | static inline int device_can_wakeup(struct device *dev) | 72 | static inline bool device_can_wakeup(struct device *dev) |
69 | { | 73 | { |
70 | return dev->power.can_wakeup; | 74 | return dev->power.can_wakeup; |
71 | } | 75 | } |
72 | 76 | ||
73 | #define device_set_wakeup_enable(dev, val) do {} while (0) | 77 | static inline void device_set_wakeup_enable(struct device *dev, bool enable) |
74 | #define device_may_wakeup(dev) 0 | 78 | { |
79 | } | ||
80 | |||
81 | static inline bool device_may_wakeup(struct device *dev) | ||
82 | { | ||
83 | return false; | ||
84 | } | ||
75 | 85 | ||
76 | #endif /* !CONFIG_PM */ | 86 | #endif /* !CONFIG_PM */ |
77 | 87 | ||