From: Wolly <wwolly@gmx.net>
To: andrew.grover@intel.com, acpi-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [patch] ACPI power off via sysrq
Date: Mon, 11 Mar 2002 14:30:30 +0100 [thread overview]
Message-ID: <20020311133239Z293727-889+120562@vger.kernel.org> (raw)
I notized that APM is able to power off the machine using
sysrq key `o´ while ACPI is not. So, here is a patch to fix that.
I've tested this patch with and without sysrq config and it
works fine for me.
Andy [Grover], please check if things are okay. I inserted a
> pm_power_off = sm_pm_power_off;
in the cleanup routine as it appears to me that the setup
routine saves the original power off function in sm_pm_power_off
and it would probably be wise to restore the original pointer
upon cleanup...
Regards,
Wolly
Patch is against 2.4.18 kernel;
patched file sm_osl.c is in drivers/acpi/ospm/system/
---------------------------<patch>---------------------------
diff -u sm_osl.c sm_osl.c-patched
--- sm_osl.c Mon Mar 11 12:52:07 2002
+++ sm_osl.c-patched Mon Mar 11 14:01:28 2002
@@ -36,6 +36,8 @@
#include <linux/mc146818rtc.h>
#include <linux/delay.h>
+#include <linux/sysrq.h>
+
#include <acpi.h>
#include "sm.h"
@@ -737,6 +739,24 @@
}
+#ifdef CONFIG_MAGIC_SYSRQ
+
+/* Simple wrapper calling power down function. */
+static void sysrq_sm_osl_power_down(int key, struct pt_regs *pt_regs,
+ struct kbd_struct *kbd, struct tty_struct *tty)
+{
+ sm_osl_power_down();
+}
+
+struct sysrq_key_op sysrq_acpi_poweroff_op = {
+ handler: &sm_osl_power_down,
+ help_msg: "Off",
+ action_msg: "Power Off\n"
+};
+
+#endif /* CONFIG_MAGIC_SYSRQ */
+
+
/****************************************************************************
*
* FUNCTION: sm_osl_add_device
@@ -765,6 +785,7 @@
if (system->states[ACPI_STATE_S5]) {
sm_pm_power_off = pm_power_off;
pm_power_off = sm_osl_power_down;
+ register_sysrq_key('o', &sysrq_acpi_poweroff_op);
}
create_proc_read_entry(SM_PROC_INFO, S_IRUGO,
@@ -828,6 +849,11 @@
remove_proc_entry(SM_PROC_INFO, sm_proc_root);
remove_proc_entry(SM_PROC_DSDT, sm_proc_root);
+
+ unregister_sysrq_key('o', &sysrq_acpi_poweroff_op);
+
+ /* Restore power off vector... */
+ pm_power_off = sm_pm_power_off;
return(AE_OK);
}
reply other threads:[~2002-03-11 13:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20020311133239Z293727-889+120562@vger.kernel.org \
--to=wwolly@gmx.net \
--cc=acpi-devel@lists.sourceforge.net \
--cc=andrew.grover@intel.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®