diff options
author | Stefan Seyfried <seife@suse.de> | 2006-12-06 23:34:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:26 -0500 |
commit | 3592695c363c3f3119621bdcf5ed852d6b9d1a5c (patch) | |
tree | bdc238af4d044ce822d88e5d18e6cf284b433728 /kernel/power | |
parent | 074cec54d1049ab580ecd0026623b553e0e270c4 (diff) |
[PATCH] uswsusp: add pmops->{prepare,enter,finish} support (aka "platform mode")
Add an ioctl to the userspace swsusp code that enables the usage of the
pmops->prepare, pmops->enter and pmops->finish methods (the in-kernel
suspend knows these as "platform method"). These are needed on many
machines to (among others) speed up resuming by letting the BIOS skip some
steps or let my hp nx5000 recognise the correct ac_adapter state after
resume again.
It also ensures on many machines, that changed hardware (unplugged AC
adapters) gets correctly detected and that kacpid does not run wild after
resume.
Signed-off-by: Stefan Seyfried <seife@suse.de>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/power.h | 7 | ||||
-rw-r--r-- | kernel/power/user.c | 28 |
2 files changed, 34 insertions, 1 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h index bfe999f7b272..87ecb1856ee8 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
@@ -117,7 +117,12 @@ extern void snapshot_free_unused_memory(struct snapshot_handle *handle); | |||
117 | #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) | 117 | #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) |
118 | #define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int) | 118 | #define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int) |
119 | #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) | 119 | #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) |
120 | #define SNAPSHOT_IOC_MAXNR 11 | 120 | #define SNAPSHOT_PMOPS _IOW(SNAPSHOT_IOC_MAGIC, 12, unsigned int) |
121 | #define SNAPSHOT_IOC_MAXNR 12 | ||
122 | |||
123 | #define PMOPS_PREPARE 1 | ||
124 | #define PMOPS_ENTER 2 | ||
125 | #define PMOPS_FINISH 3 | ||
121 | 126 | ||
122 | /** | 127 | /** |
123 | * The bitmap is used for tracing allocated swap pages | 128 | * The bitmap is used for tracing allocated swap pages |
diff --git a/kernel/power/user.c b/kernel/power/user.c index d991d3b0e5a4..4c24ca5d62e3 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/suspend.h> | 12 | #include <linux/suspend.h> |
13 | #include <linux/syscalls.h> | 13 | #include <linux/syscalls.h> |
14 | #include <linux/reboot.h> | ||
14 | #include <linux/string.h> | 15 | #include <linux/string.h> |
15 | #include <linux/device.h> | 16 | #include <linux/device.h> |
16 | #include <linux/miscdevice.h> | 17 | #include <linux/miscdevice.h> |
@@ -313,6 +314,33 @@ OutS3: | |||
313 | up(&pm_sem); | 314 | up(&pm_sem); |
314 | break; | 315 | break; |
315 | 316 | ||
317 | case SNAPSHOT_PMOPS: | ||
318 | switch (arg) { | ||
319 | |||
320 | case PMOPS_PREPARE: | ||
321 | if (pm_ops->prepare) { | ||
322 | error = pm_ops->prepare(PM_SUSPEND_DISK); | ||
323 | } | ||
324 | break; | ||
325 | |||
326 | case PMOPS_ENTER: | ||
327 | kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); | ||
328 | error = pm_ops->enter(PM_SUSPEND_DISK); | ||
329 | break; | ||
330 | |||
331 | case PMOPS_FINISH: | ||
332 | if (pm_ops && pm_ops->finish) { | ||
333 | pm_ops->finish(PM_SUSPEND_DISK); | ||
334 | } | ||
335 | break; | ||
336 | |||
337 | default: | ||
338 | printk(KERN_ERR "SNAPSHOT_PMOPS: invalid argument %ld\n", arg); | ||
339 | error = -EINVAL; | ||
340 | |||
341 | } | ||
342 | break; | ||
343 | |||
316 | default: | 344 | default: |
317 | error = -ENOTTY; | 345 | error = -ENOTTY; |
318 | 346 | ||