#include <asm/uaccess.h>
#include <asm/desc.h>
-#include <linux/sysrq.h>
-
extern spinlock_t i8253_lock;
extern unsigned long get_cmos_time(void);
extern void machine_real_restart(unsigned char *, int);
(void) set_system_power_state(APM_STATE_OFF);
}
-/**
- * handle_poweroff - sysrq callback for power down
- * @key: key pressed (unused)
- * @pt_regs: register state (unused)
- * @kbd: keyboard state (unused)
- * @tty: tty involved (unused)
- *
- * When the user hits Sys-Rq o to power down the machine this is the
- * callback we use.
- */
-
-static void handle_poweroff (int key, struct pt_regs *pt_regs,
- struct tty_struct *tty)
-{
- apm_power_off();
-}
-
-static struct sysrq_key_op sysrq_poweroff_op = {
- .handler = handle_poweroff,
- .help_msg = "Off",
- .action_msg = "Power Off\n"
-};
-
-
#ifdef CONFIG_APM_DO_ENABLE
/**
/* Install our power off handler.. */
if (power_off)
pm_power_off = apm_power_off;
- register_sysrq_key('o', &sysrq_poweroff_op);
if (num_online_cpus() == 1 || smp) {
#if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
}
misc_deregister(&apm_device);
remove_proc_entry("apm", NULL);
- unregister_sysrq_key('o',&sysrq_poweroff_op);
if (power_off)
pm_power_off = NULL;
exit_kapmd = 1;
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*/
-#include <linux/kernel.h>
-#include <linux/sysrq.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/pm.h>
return status;
}
-#if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_PM)
-
-/* Simple wrapper calling power down function. */
-static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs,
- struct tty_struct *tty)
-{
- acpi_power_off();
-}
-
-struct sysrq_key_op sysrq_acpi_poweroff_op = {
- .handler = &acpi_sysrq_power_off,
- .help_msg = "Off",
- .action_msg = "Power Off\n"
-};
-
-#endif /* CONFIG_MAGIC_SYSRQ */
-
static int __init acpi_sleep_init(void)
{
acpi_status status = AE_OK;
/* Install the soft-off (S5) handler. */
if (sleep_states[ACPI_STATE_S5]) {
pm_power_off = acpi_power_off;
- register_sysrq_key('o', &sysrq_acpi_poweroff_op);
/* workaround: some systems don't claim S4 support, but they
do support S5 (power-down). That is all we need, so
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/interrupt.h>
+#include <linux/sysrq.h>
int pm_active;
EXPORT_SYMBOL(pm_send_all);
EXPORT_SYMBOL(pm_find);
EXPORT_SYMBOL(pm_active);
+
+
+#ifdef CONFIG_MAGIC_SYSRQ
+
+/**
+ * handle_poweroff - sysrq callback for power down
+ * @key: key pressed (unused)
+ * @pt_regs: register state (unused)
+ * @kbd: keyboard state (unused)
+ * @tty: tty involved (unused)
+ *
+ * When the user hits Sys-Rq o to power down the machine this is the
+ * callback we use.
+ */
+
+static void handle_poweroff (int key, struct pt_regs *pt_regs,
+ struct tty_struct *tty)
+{
+ if (pm_power_off)
+ pm_power_off();
+}
+
+static struct sysrq_key_op sysrq_poweroff_op = {
+ .handler = handle_poweroff,
+ .help_msg = "powerOff",
+ .action_msg = "Power Off\n"
+};
+
+#endif /* CONFIG_MAGIC_SYSRQ */
+
+
+static int pm_init(void)
+{
+ register_sysrq_key('o', &sysrq_poweroff_op);
+ return 0;
+}
+
+subsys_initcall(pm_init);