aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-03-19 17:37:42 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:25 -0400
commitd288e47c471e1090e80c62ad95882fafbf3f499d (patch)
treebfc8a880b49a0b7a0bb200ae0f0462f5523d0256
parent74081f8667d73ad59961cf63be5f0e9d6a87c8a3 (diff)
PM: Make wakeup flags available whenever CONFIG_PM is set
The various wakeup flags and their accessor macros in struct dev_pm_info should be available whenever CONFIG_PM is enabled, not just when CONFIG_PM_SLEEP is on. Otherwise remote wakeup won't always be configurable for runtime power management. This patch (as1056b) fixes the oversight. David Brownell adds: More accurately, fixes the "regression" ... as noted sometime last summer, after 296699de6bdc717189a331ab6bbe90e05c94db06 introduced CONFIG_SUSPEND. But that didn't make the regression list for that kernel, ergo the delay in fixing it. [rjw: rebased] Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/power/main.c2
-rw-r--r--drivers/base/power/sysfs.c2
-rw-r--r--include/linux/pm.h36
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 */
58static bool all_sleeping; 58static bool all_sleeping;
59 59
60int (*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
9int (*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 {
183struct dev_pm_info { 183struct 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);
198extern int device_suspend(pm_message_t state); 198extern int device_suspend(pm_message_t state);
199extern int device_prepare_suspend(pm_message_t state); 199extern 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
206extern void __suspend_report_result(const char *function, void *fn, int ret); 201extern 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
210static 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
229static 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
239static inline int call_platform_enable_wakeup(struct device *dev, int is_on) 245static 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.