diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-03-14 19:43:46 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-03-14 19:43:46 -0400 |
commit | 40dc166cb5dddbd36aa4ad11c03915ea538f5a61 (patch) | |
tree | 0a778159cf89ddee9e7d3134ae40569bdccd2a24 /kernel/sys.c | |
parent | f9b9e806ae0ede772cbb9916d9ac7354a123d044 (diff) |
PM / Core: Introduce struct syscore_ops for core subsystems PM
Some subsystems need to carry out suspend/resume and shutdown
operations with one CPU on-line and interrupts disabled. The only
way to register such operations is to define a sysdev class and
a sysdev specifically for this purpose which is cumbersome and
inefficient. Moreover, the arguments taken by sysdev suspend,
resume and shutdown callbacks are practically never necessary.
For this reason, introduce a simpler interface allowing subsystems
to register operations to be executed very late during system suspend
and shutdown and very early during resume in the form of
strcut syscore_ops objects.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 18da702ec813..1ad48b3b9068 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/ptrace.h> | 37 | #include <linux/ptrace.h> |
38 | #include <linux/fs_struct.h> | 38 | #include <linux/fs_struct.h> |
39 | #include <linux/gfp.h> | 39 | #include <linux/gfp.h> |
40 | #include <linux/syscore_ops.h> | ||
40 | 41 | ||
41 | #include <linux/compat.h> | 42 | #include <linux/compat.h> |
42 | #include <linux/syscalls.h> | 43 | #include <linux/syscalls.h> |
@@ -298,6 +299,7 @@ void kernel_restart_prepare(char *cmd) | |||
298 | system_state = SYSTEM_RESTART; | 299 | system_state = SYSTEM_RESTART; |
299 | device_shutdown(); | 300 | device_shutdown(); |
300 | sysdev_shutdown(); | 301 | sysdev_shutdown(); |
302 | syscore_shutdown(); | ||
301 | } | 303 | } |
302 | 304 | ||
303 | /** | 305 | /** |
@@ -336,6 +338,7 @@ void kernel_halt(void) | |||
336 | { | 338 | { |
337 | kernel_shutdown_prepare(SYSTEM_HALT); | 339 | kernel_shutdown_prepare(SYSTEM_HALT); |
338 | sysdev_shutdown(); | 340 | sysdev_shutdown(); |
341 | syscore_shutdown(); | ||
339 | printk(KERN_EMERG "System halted.\n"); | 342 | printk(KERN_EMERG "System halted.\n"); |
340 | kmsg_dump(KMSG_DUMP_HALT); | 343 | kmsg_dump(KMSG_DUMP_HALT); |
341 | machine_halt(); | 344 | machine_halt(); |
@@ -355,6 +358,7 @@ void kernel_power_off(void) | |||
355 | pm_power_off_prepare(); | 358 | pm_power_off_prepare(); |
356 | disable_nonboot_cpus(); | 359 | disable_nonboot_cpus(); |
357 | sysdev_shutdown(); | 360 | sysdev_shutdown(); |
361 | syscore_shutdown(); | ||
358 | printk(KERN_EMERG "Power down.\n"); | 362 | printk(KERN_EMERG "Power down.\n"); |
359 | kmsg_dump(KMSG_DUMP_POWEROFF); | 363 | kmsg_dump(KMSG_DUMP_POWEROFF); |
360 | machine_power_off(); | 364 | machine_power_off(); |