Blame view
kernel/power/poweroff.c
980 Bytes
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 |
/* * poweroff.c - sysrq handler to gracefully power down machine. * * This file is released under the GPL v2 */ #include <linux/kernel.h> #include <linux/sysrq.h> #include <linux/init.h> #include <linux/pm.h> #include <linux/workqueue.h> |
ff3197778 [PATCH] Use kerne... |
12 |
#include <linux/reboot.h> |
2f15fc4bd pm: schedule sysr... |
13 |
#include <linux/cpumask.h> |
1da177e4c Linux-2.6.12-rc2 |
14 15 16 17 18 |
/* * When the user hits Sys-Rq o to power down the machine this is the * callback we use. */ |
65f27f384 WorkStruct: Pass ... |
19 |
static void do_poweroff(struct work_struct *dummy) |
1da177e4c Linux-2.6.12-rc2 |
20 |
{ |
ff3197778 [PATCH] Use kerne... |
21 |
kernel_power_off(); |
1da177e4c Linux-2.6.12-rc2 |
22 |
} |
65f27f384 WorkStruct: Pass ... |
23 |
static DECLARE_WORK(poweroff_work, do_poweroff); |
1da177e4c Linux-2.6.12-rc2 |
24 |
|
1495cc9df Input: sysrq - dr... |
25 |
static void handle_poweroff(int key) |
1da177e4c Linux-2.6.12-rc2 |
26 |
{ |
2f15fc4bd pm: schedule sysr... |
27 |
/* run sysrq poweroff on boot cpu */ |
41c7bb958 cpumask: convert ... |
28 |
schedule_work_on(cpumask_first(cpu_online_mask), &poweroff_work); |
1da177e4c Linux-2.6.12-rc2 |
29 30 31 32 33 34 |
} static struct sysrq_key_op sysrq_poweroff_op = { .handler = handle_poweroff, .help_msg = "powerOff", .action_msg = "Power Off", |
1dc492a0a trivial: kernel/p... |
35 |
.enable_mask = SYSRQ_ENABLE_BOOT, |
1da177e4c Linux-2.6.12-rc2 |
36 37 38 39 40 41 42 43 44 |
}; static int pm_sysrq_init(void) { register_sysrq_key('o', &sysrq_poweroff_op); return 0; } subsys_initcall(pm_sysrq_init); |