From: akuster <akuster@mvista.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel-owner@vger.kernel.org, linux-pm@lists.osdl.org
Subject: [PATCH 2/2] PM: fast power off - driver
Date: Sat, 27 Jan 2007 09:36:57 -1000 [thread overview]
Message-ID: <45BBA9D9.5060307@mvista.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: fastpoweroff-1.0_driver.patch --]
[-- Type: text/x-patch, Size: 3040 bytes --]
Fastpoweroff default profile driver
signed-off-by: Armin Kuster <AKuster@mvista.com>
---
kernel/power/fastoff/Kconfig | 8 ++++
kernel/power/fastoff/Makefile | 2 -
kernel/power/fastoff/fastoffdrv.c | 69 ++++++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 1 deletion(-)
Index: linux-2.6_dev/kernel/power/fastoff/fastoffdrv.c
===================================================================
--- /dev/null
+++ linux-2.6_dev/kernel/power/fastoff/fastoffdrv.c
@@ -0,0 +1,69 @@
+/*
+ * kernel/power/fastoff/fastoffdrv.c
+ *
+ * This provides a sysfs interface that allows the user to
+ * bypass running rc kill scripts in the advent the user
+ * needed to power down as fast as possible. This could be
+ * in a low battery conditon and you want to try to keep
+ * data from being corrupted.
+ *
+ * Author: Armin Kuster <AKuster@mvista.com, or source@mvista.com>
+ *
+ * 2006, 2007 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+
+#include "../power.h"
+#include "fpo.h"
+
+static int fsd_default_off(void)
+{
+ /*
+ * Actions taken:
+ *
+ * 1. Freeze all user processes.
+ *
+ * 2. Power off
+ *
+ * 3. Power off devices
+ */
+
+ printk(KERN_EMERG "Fast Power Off initiated.\n");
+ fastpoweroff_prepare();
+ fastpoweroff();
+ fastpoweroff_standby();
+ return 1;
+}
+
+static struct fpo_driver fpo_default = {
+ .name = "default",
+ .policy = fsd_default_off,
+};
+
+static int __init fsd_default_init(void)
+{
+ int ret = 0;
+
+ if(( ret = fastpoweroff_register(&fpo_default)) < 0) {
+ printk(KERN_ERR "PM: Fastpoweroff: %s profile registation failed %d.\n",
+ fpo_default.name,ret);
+ goto errout;
+ }
+
+ printk(KERN_INFO "PM: Fastpoweroff, %s profile added\n",fpo_default.name);
+errout:
+ return ret;
+}
+
+module_init(fsd_default_init);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Armin Kuster <akuster@mvista.com>");
+
Index: linux-2.6_dev/kernel/power/fastoff/Kconfig
===================================================================
--- linux-2.6_dev.orig/kernel/power/fastoff/Kconfig
+++ linux-2.6_dev/kernel/power/fastoff/Kconfig
@@ -10,4 +10,12 @@ config FAST_POWER_OFF
---help---
Say yes if you want core support for sysfs/power/fastoff
+config FAST_POWER_DOWN
+ tristate "Fast power of profile"
+ depends on FAST_POWER_OFF
+ default n
+ ---help---
+ Say yes if want to bypass the rc kill scripts
+ and shut the machine down
+
endmenu
Index: linux-2.6_dev/kernel/power/fastoff/Makefile
===================================================================
--- linux-2.6_dev.orig/kernel/power/fastoff/Makefile
+++ linux-2.6_dev/kernel/power/fastoff/Makefile
@@ -5,4 +5,4 @@
#
obj-$(CONFIG_FAST_POWER_OFF) := fpo.o
-
+obj-$(CONFIG_FAST_POWER_DOWN) += fastoffdrv.o
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
next reply other threads:[~2007-01-27 19:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-27 19:36 akuster [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-01-27 20:05 [PATCH 2/2] PM: fast power off - driver akuster
2007-01-28 3:20 ` Andi Kleen
2007-01-28 18:09 ` Randy Dunlap
2007-01-29 17:41 ` akuster
2007-01-29 17:41 ` akuster
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=45BBA9D9.5060307@mvista.com \
--to=akuster@mvista.com \
--cc=akpm@osdl.org \
--cc=linux-kernel-owner@vger.kernel.org \
--cc=linux-pm@lists.osdl.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.