diff options
-rw-r--r-- | drivers/base/power/main.c | 2 | ||||
-rw-r--r-- | drivers/base/power/sysfs.c | 2 | ||||
-rw-r--r-- | include/linux/pm.h | 36 |
3 files changed, 23 insertions, 17 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 93a146940b91..5630af302b2f 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -57,8 +57,6 @@ static DEFINE_MUTEX(dpm_list_mtx); | |||
57 | /* 'true' if all devices have been suspended, protected by dpm_list_mtx */ | 57 | /* 'true' if all devices have been suspended, protected by dpm_list_mtx */ |
58 | static bool all_sleeping; | 58 | static bool all_sleeping; |
59 | 59 | ||
60 | int (*platform_enable_wakeup)(struct device *dev, int is_on); | ||
61 | |||
62 | /** | 60 | /** |
63 | * device_pm_add - add a device to the list of active devices | 61 | * device_pm_add - add a device to the list of active devices |
64 | * @dev: Device to be added to the list | 62 | * @dev: Device to be added to the list |
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index f2ed179cd695..d11f74b038db 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c | |||
@@ -6,6 +6,8 @@ | |||
6 | #include <linux/string.h> | 6 | #include <linux/string.h> |
7 | #include "power.h" | 7 | #include "power.h" |
8 | 8 | ||
9 | int (*platform_enable_wakeup)(struct device *dev, int is_on); | ||
10 | |||
9 | 11 | ||
10 | /* | 12 | /* |
11 | * wakeup - Report/change current wakeup option for device | 13 | * wakeup - Report/change current wakeup option for device |
diff --git a/include/linux/pm.h b/include/linux/pm.h index e6b9f29e27d7..3342627e2bd6 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -183,9 +183,9 @@ typedef struct pm_message { | |||
183 | struct dev_pm_info { | 183 | struct dev_pm_info { |
184 | pm_message_t power_state; | 184 | pm_message_t power_state; |
185 | unsigned can_wakeup:1; | 185 | unsigned can_wakeup:1; |
186 | unsigned should_wakeup:1; | ||
186 | bool sleeping:1; /* Owned by the PM core */ | 187 | bool sleeping:1; /* Owned by the PM core */ |
187 | #ifdef CONFIG_PM_SLEEP | 188 | #ifdef CONFIG_PM_SLEEP |
188 | unsigned should_wakeup:1; | ||
189 | struct list_head entry; | 189 | struct list_head entry; |
190 | #endif | 190 | #endif |
191 | }; | 191 | }; |
@@ -198,11 +198,6 @@ extern void device_resume(void); | |||
198 | extern int device_suspend(pm_message_t state); | 198 | extern int device_suspend(pm_message_t state); |
199 | extern int device_prepare_suspend(pm_message_t state); | 199 | extern int device_prepare_suspend(pm_message_t state); |
200 | 200 | ||
201 | #define device_set_wakeup_enable(dev,val) \ | ||
202 | ((dev)->power.should_wakeup = !!(val)) | ||
203 | #define device_may_wakeup(dev) \ | ||
204 | (device_can_wakeup(dev) && (dev)->power.should_wakeup) | ||
205 | |||
206 | extern void __suspend_report_result(const char *function, void *fn, int ret); | 201 | extern void __suspend_report_result(const char *function, void *fn, int ret); |
207 | 202 | ||
208 | #define suspend_report_result(fn, ret) \ | 203 | #define suspend_report_result(fn, ret) \ |
@@ -210,6 +205,24 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
210 | __suspend_report_result(__FUNCTION__, fn, ret); \ | 205 | __suspend_report_result(__FUNCTION__, fn, ret); \ |
211 | } while (0) | 206 | } while (0) |
212 | 207 | ||
208 | #else /* !CONFIG_PM_SLEEP */ | ||
209 | |||
210 | static inline int device_suspend(pm_message_t state) | ||
211 | { | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | #define suspend_report_result(fn, ret) do { } while (0) | ||
216 | |||
217 | #endif /* !CONFIG_PM_SLEEP */ | ||
218 | |||
219 | #ifdef CONFIG_PM | ||
220 | |||
221 | #define device_set_wakeup_enable(dev,val) \ | ||
222 | ((dev)->power.should_wakeup = !!(val)) | ||
223 | #define device_may_wakeup(dev) \ | ||
224 | (device_can_wakeup(dev) && (dev)->power.should_wakeup) | ||
225 | |||
213 | /* | 226 | /* |
214 | * Platform hook to activate device wakeup capability, if that's not already | 227 | * Platform hook to activate device wakeup capability, if that's not already |
215 | * handled by enable_irq_wake() etc. | 228 | * handled by enable_irq_wake() etc. |
@@ -224,24 +237,17 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | |||
224 | return 0; | 237 | return 0; |
225 | } | 238 | } |
226 | 239 | ||
227 | #else /* !CONFIG_PM_SLEEP */ | 240 | #else /* !CONFIG_PM */ |
228 | |||
229 | static inline int device_suspend(pm_message_t state) | ||
230 | { | ||
231 | return 0; | ||
232 | } | ||
233 | 241 | ||
234 | #define device_set_wakeup_enable(dev,val) do{}while(0) | 242 | #define device_set_wakeup_enable(dev,val) do{}while(0) |
235 | #define device_may_wakeup(dev) (0) | 243 | #define device_may_wakeup(dev) (0) |
236 | 244 | ||
237 | #define suspend_report_result(fn, ret) do { } while (0) | ||
238 | |||
239 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | 245 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) |
240 | { | 246 | { |
241 | return 0; | 247 | return 0; |
242 | } | 248 | } |
243 | 249 | ||
244 | #endif /* !CONFIG_PM_SLEEP */ | 250 | #endif /* !CONFIG_PM */ |
245 | 251 | ||
246 | /* changes to device_may_wakeup take effect on the next pm state change. | 252 | /* changes to device_may_wakeup take effect on the next pm state change. |
247 | * by default, devices should wakeup if they can. | 253 | * by default, devices should wakeup if they can. |