From: Stefan Seyfried <seife@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Pavel Machek <pavel@suse.cz>, "Rafael J. Wysocki" <rjw@sisk.pl>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH] uswsusp: add pmops->{prepare,enter,finish} support (aka "platform mode")
Date: Mon, 25 Sep 2006 09:13:38 +0200 [thread overview]
Message-ID: <20060925071338.GD9869@suse.de> (raw)
From: Stefan Seyfried <seife@suse.de>
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.
Signed-off-by: Stefan Seyfried <seife@suse.de>
---
Patch is against 2.6.18. AFAIK little has changed in this area recently, so
it should still apply. I have two machines that are pretty broken without it,
so it is rather urgent for me :-)
Please apply.
diff -rup a/kernel/power/power.h b/kernel/power/power.h
--- a/kernel/power/power.h 2006-09-20 05:42:06.000000000 +0200
+++ b/kernel/power/power.h 2006-09-25 08:42:46.000000000 +0200
@@ -78,7 +78,12 @@ int snapshot_image_loaded(struct snapsho
#define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9)
#define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int)
#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
-#define SNAPSHOT_IOC_MAXNR 11
+#define SNAPSHOT_PMOPS _IOW(SNAPSHOT_IOC_MAGIC, 12, unsigned int)
+#define SNAPSHOT_IOC_MAXNR 12
+
+#define PMOPS_PREPARE 1
+#define PMOPS_ENTER 2
+#define PMOPS_FINISH 3
/**
* The bitmap is used for tracing allocated swap pages
diff -rup a/kernel/power/user.c b/kernel/power/user.c
--- a/kernel/power/user.c 2006-09-20 05:42:06.000000000 +0200
+++ b/kernel/power/user.c 2006-09-12 18:45:34.000000000 +0200
@@ -11,6 +11,7 @@
#include <linux/suspend.h>
#include <linux/syscalls.h>
+#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
@@ -302,6 +303,33 @@ OutS3:
up(&pm_sem);
break;
+ case SNAPSHOT_PMOPS:
+ switch (arg) {
+
+ case PMOPS_PREPARE:
+ if (pm_ops->prepare) {
+ error = pm_ops->prepare(PM_SUSPEND_DISK);
+ }
+ break;
+
+ case PMOPS_ENTER:
+ kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
+ error = pm_ops->enter(PM_SUSPEND_DISK);
+ break;
+
+ case PMOPS_FINISH:
+ if (pm_ops && pm_ops->finish) {
+ pm_ops->finish(PM_SUSPEND_DISK);
+ }
+ break;
+
+ default:
+ printk(KERN_ERR "SNAPSHOT_PMOPS: invalid argument %ld\n", arg);
+ error = -EINVAL;
+
+ }
+ break;
+
default:
error = -ENOTTY;
--
Stefan Seyfried
QA / R&D Team Mobile Devices | "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out."
next reply other threads:[~2006-09-25 7:15 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-25 7:13 Stefan Seyfried [this message]
2006-09-25 8:12 ` [PATCH] uswsusp: add pmops->{prepare,enter,finish} support (aka "platform mode") Rafael J. Wysocki
2006-09-25 8:17 ` Pavel Machek
2006-09-25 19:02 ` Rafael J. Wysocki
2006-09-25 21:34 ` When will the lunacy end? (Was Re: [PATCH] uswsusp: add pmops->{prepare,enter,finish} support (aka "platform mode")) Nigel Cunningham
2006-09-25 21:45 ` Andrew Morton
2006-09-25 22:45 ` Pavel Machek
2006-09-25 23:06 ` Andrew Morton
2006-09-25 23:21 ` Pavel Machek
2006-09-26 0:22 ` Andrew Morton
2006-09-26 10:08 ` Stefan Seyfried
2006-09-26 10:24 ` Pavel Machek
2006-09-26 16:46 ` Andrew Morton
2006-09-27 9:09 ` Pavel Machek
2006-09-27 21:08 ` Andrew Morton
2006-09-27 21:13 ` Rafael J. Wysocki
2006-09-27 21:34 ` Pavel Machek
2006-09-27 22:58 ` Andrew Morton
2006-09-27 23:18 ` Pavel Machek
2006-09-26 19:46 ` Rafael J. Wysocki
2006-09-26 16:45 ` Bryan O'Sullivan
2006-09-26 17:44 ` Alan Cox
2006-09-26 17:29 ` Bryan O'Sullivan
2006-09-27 9:09 ` Pavel Machek
2006-09-26 19:56 ` Rafael J. Wysocki
2006-09-26 20:14 ` Adrian Bunk
2006-09-26 20:35 ` Rafael J. Wysocki
2006-09-26 21:38 ` Nigel Cunningham
2006-09-26 22:31 ` Adrian Bunk
2006-09-26 22:51 ` Rafael J. Wysocki
2006-09-26 23:05 ` Nigel Cunningham
2006-09-26 23:31 ` Rafael J. Wysocki
2006-09-26 23:39 ` Adrian Bunk
2006-09-27 0:16 ` Andrew Morton
2006-09-27 5:12 ` Rafael J. Wysocki
2006-09-27 5:39 ` Nigel Cunningham
2006-09-27 6:00 ` Andrew Morton
2006-09-27 7:47 ` Rafael J. Wysocki
2006-09-27 8:58 ` Pavel Machek
2006-09-27 9:02 ` Pavel Machek
2006-09-27 23:21 ` Adrian Bunk
2006-09-28 10:59 ` Rafael J. Wysocki
2006-09-26 23:43 ` Nigel Cunningham
2006-09-25 22:34 ` Pavel Machek
2006-09-26 10:12 ` Stefan Seyfried
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060925071338.GD9869@suse.de \
--to=seife@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@suse.cz \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox