summaryrefslogtreecommitdiff
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-11-30 04:56:07 (GMT)
committerSteve French <sfrench@us.ibm.com>2005-11-30 04:56:07 (GMT)
commit606c0dafbe88102d64c1253caed8a2c36987070f (patch)
tree23ce7b30341e71c6da8e0183d27e29167e833e26 /kernel/power/main.c
parent6ab16d249513a50bef3f1b275cea6aa8d3f51832 (diff)
parentd2ef5ebb4c4fe141a82252d4db8d8521e6765c5a (diff)
downloadlinux-fsl-qoriq-606c0dafbe88102d64c1253caed8a2c36987070f.tar.xz
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 6ee2cad..d253f3a 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -24,7 +24,7 @@
DECLARE_MUTEX(pm_sem);
-struct pm_ops * pm_ops = NULL;
+struct pm_ops *pm_ops;
suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
/**
@@ -151,6 +151,18 @@ static char *pm_states[PM_SUSPEND_MAX] = {
#endif
};
+static inline int valid_state(suspend_state_t state)
+{
+ /* Suspend-to-disk does not really need low-level support.
+ * It can work with reboot if needed. */
+ if (state == PM_SUSPEND_DISK)
+ return 1;
+
+ if (pm_ops && pm_ops->valid && !pm_ops->valid(state))
+ return 0;
+ return 1;
+}
+
/**
* enter_state - Do common work of entering low-power state.
@@ -167,7 +179,7 @@ static int enter_state(suspend_state_t state)
{
int error;
- if (pm_ops && pm_ops->valid && !pm_ops->valid(state))
+ if (!valid_state(state))
return -ENODEV;
if (down_trylock(&pm_sem))
return -EBUSY;
@@ -238,9 +250,8 @@ static ssize_t state_show(struct subsystem * subsys, char * buf)
char * s = buf;
for (i = 0; i < PM_SUSPEND_MAX; i++) {
- if (pm_states[i] && pm_ops && (!pm_ops->valid
- ||(pm_ops->valid && pm_ops->valid(i))))
- s += sprintf(s,"%s ",pm_states[i]);
+ if (pm_states[i] && valid_state(i))
+ s += sprintf(s,"%s ", pm_states[i]);
}
s += sprintf(s,"\n");
return (s - buf);