[PATCH] fix swsusp on machines not supporting S4
From: Pavel Machek (pavel_at_ucw.cz)
Date: 11/29/05
- Previous message: Bartlomiej Zolnierkiewicz: "Re: ide-cd doesn't replace ide-scsi?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Nov 2005 16:08:02 +0100 To: Andrew Morton <akpm@osdl.org>, Len Brown <len.brown@intel.com>, kernel list <linux-kernel@vger.kernel.org>, ACPI mailing list <acpi-devel@lists.sourceforge.net>
Fix swsusp on machines not supporting S4. With recent changes, it is
not possible to trigger it using /sys filesystem. Swsusp does not
really need any support from low-level code, it is possible to reboot
or halt at the end of suspend.
Signed-off-by: Pavel Machek <pavel@suse.cz>
---
commit 72936ce37893098af1e2ec30b95274ca721bbf82
tree 5b6aaf5cd5402bfc19b3faeab179c88803756805
parent 3248196034f5f0a93554b441bd41af2620afa635
author <pavel@amd.(none)> Tue, 29 Nov 2005 16:05:14 +0100
committer <pavel@amd.(none)> Tue, 29 Nov 2005 16:05:14 +0100
kernel/power/main.c | 21 ++++++++++++++++-----
kernel/power/power.h | 3 ---
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/kernel/power/main.c b/kernel/power/main.c
--- 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 = NULL;
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 s
{
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 subsyst
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);
--
Thanks, Sharp!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Bartlomiej Zolnierkiewicz: "Re: ide-cd doesn't replace ide-scsi?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: 2.6: unused code under drivers/message/fusion/
... > The proposed generic target mode drivers proposal is yet part ... >
We are looking into supporting this once its available. ... considering for the kernel
inclusion at least until 2.7. ... send the line "unsubscribe linux-kernel" in ...
(Linux-Kernel) - Re: ioctls, etc. (was Re: [PATCH 1/4] sas: add flag for locally attached PHYs)
... Luben Tuikov disait dernièrement que: ... because it means down time
and supporting two systems ... send the line "unsubscribe linux-kernel" in ...
(Linux-Kernel) - Re: [PATCH] Blacklist binary-only modules lying about their license
... >> for doing it (i.e. supporting the modules). ... The tainted mechanism
is there to tell us that it's not ... We don't use a script to systematically load the
modules, ... send the line "unsubscribe linux-kernel" in ... (Linux-Kernel) - Re: [GIT PATCH] Remove devfs from 2.6.13
... >> I'll admit I don't keep track of the distros and what kernels and features
... the first distro's supporting it? ... but he did start to maintain the udev
package around ... send the line "unsubscribe linux-kernel" in ... (Linux-Kernel) - Re: XFS for 2.4
... >>This will merge the core 2.4 kernel changes required for supporting
... >>the XFS filesystem, as listed below. ... send the line "unsubscribe
linux-kernel" in ... (Linux-Kernel)