diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-02-08 17:26:02 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-03-14 19:43:14 -0400 |
commit | cb8f51bdadb7969139c2e39c2defd4cde98c1ea8 (patch) | |
tree | a6d6e20878460d50b8f61d5fe3237818c54065eb /include/linux | |
parent | 4681b17154b3fd81f898802262985f662344e6ed (diff) |
PM: Do not create wakeup sysfs files for devices that cannot wake up
Currently, wakeup sysfs attributes are created for all devices,
regardless of whether or not they are wakeup-capable. This is
excessive and complicates wakeup device identification from user
space (i.e. to identify wakeup-capable devices user space has to read
/sys/devices/.../power/wakeup for all devices and see if they are not
empty).
Fix this issue by avoiding to create wakeup sysfs files for devices
that cannot wake up the system from sleep states (i.e. whose
power.can_wakeup flags are unset during registration) and modify
device_set_wakeup_capable() so that it adds (or removes) the relevant
sysfs attributes if a device's wakeup capability status is changed.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/pm_runtime.h | 6 | ||||
-rw-r--r-- | include/linux/pm_wakeup.h | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index d34f067e2a7f..8de9aa6e7def 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
@@ -87,6 +87,11 @@ static inline bool pm_runtime_enabled(struct device *dev) | |||
87 | return !dev->power.disable_depth; | 87 | return !dev->power.disable_depth; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline bool pm_runtime_callbacks_present(struct device *dev) | ||
91 | { | ||
92 | return !dev->power.no_callbacks; | ||
93 | } | ||
94 | |||
90 | static inline void pm_runtime_mark_last_busy(struct device *dev) | 95 | static inline void pm_runtime_mark_last_busy(struct device *dev) |
91 | { | 96 | { |
92 | ACCESS_ONCE(dev->power.last_busy) = jiffies; | 97 | ACCESS_ONCE(dev->power.last_busy) = jiffies; |
@@ -133,6 +138,7 @@ static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } | |||
133 | static inline void pm_runtime_no_callbacks(struct device *dev) {} | 138 | static inline void pm_runtime_no_callbacks(struct device *dev) {} |
134 | static inline void pm_runtime_irq_safe(struct device *dev) {} | 139 | static inline void pm_runtime_irq_safe(struct device *dev) {} |
135 | 140 | ||
141 | static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; } | ||
136 | static inline void pm_runtime_mark_last_busy(struct device *dev) {} | 142 | static inline void pm_runtime_mark_last_busy(struct device *dev) {} |
137 | static inline void __pm_runtime_use_autosuspend(struct device *dev, | 143 | static inline void __pm_runtime_use_autosuspend(struct device *dev, |
138 | bool use) {} | 144 | bool use) {} |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 03a67db03d01..a32da962d693 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
@@ -62,18 +62,11 @@ struct wakeup_source { | |||
62 | * Changes to device_may_wakeup take effect on the next pm state change. | 62 | * Changes to device_may_wakeup take effect on the next pm state change. |
63 | */ | 63 | */ |
64 | 64 | ||
65 | static inline void device_set_wakeup_capable(struct device *dev, bool capable) | ||
66 | { | ||
67 | dev->power.can_wakeup = capable; | ||
68 | } | ||
69 | |||
70 | static inline bool device_can_wakeup(struct device *dev) | 65 | static inline bool device_can_wakeup(struct device *dev) |
71 | { | 66 | { |
72 | return dev->power.can_wakeup; | 67 | return dev->power.can_wakeup; |
73 | } | 68 | } |
74 | 69 | ||
75 | |||
76 | |||
77 | static inline bool device_may_wakeup(struct device *dev) | 70 | static inline bool device_may_wakeup(struct device *dev) |
78 | { | 71 | { |
79 | return dev->power.can_wakeup && !!dev->power.wakeup; | 72 | return dev->power.can_wakeup && !!dev->power.wakeup; |
@@ -88,6 +81,7 @@ extern struct wakeup_source *wakeup_source_register(const char *name); | |||
88 | extern void wakeup_source_unregister(struct wakeup_source *ws); | 81 | extern void wakeup_source_unregister(struct wakeup_source *ws); |
89 | extern int device_wakeup_enable(struct device *dev); | 82 | extern int device_wakeup_enable(struct device *dev); |
90 | extern int device_wakeup_disable(struct device *dev); | 83 | extern int device_wakeup_disable(struct device *dev); |
84 | extern void device_set_wakeup_capable(struct device *dev, bool capable); | ||
91 | extern int device_init_wakeup(struct device *dev, bool val); | 85 | extern int device_init_wakeup(struct device *dev, bool val); |
92 | extern int device_set_wakeup_enable(struct device *dev, bool enable); | 86 | extern int device_set_wakeup_enable(struct device *dev, bool enable); |
93 | extern void __pm_stay_awake(struct wakeup_source *ws); | 87 | extern void __pm_stay_awake(struct wakeup_source *ws); |