diff options
| author | Amerigo Wang <amwang@redhat.com> | 2011-07-25 20:13:10 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-25 23:57:14 -0400 |
| commit | c5f41752fd37979dbaec61dc59c7ece0606ddf7e (patch) | |
| tree | 47827a7fd86cbe4ad657d640b01e8b76535e8813 | |
| parent | dcfe1421c916345b068f43749263b94270324500 (diff) | |
notifiers: sys: move reboot notifiers into reboot.h
It is not necessary to share the same notifier.h.
This patch already moves register_reboot_notifier() and
unregister_reboot_notifier() from kernel/notifier.c to kernel/sys.c.
[amwang@redhat.com: make allyesconfig succeed on ppc64]
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: David Miller <davem@davemloft.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | arch/powerpc/kernel/rtas.c | 1 | ||||
| -rw-r--r-- | arch/powerpc/kernel/rtas_flash.c | 1 | ||||
| -rw-r--r-- | include/linux/notifier.h | 5 | ||||
| -rw-r--r-- | include/linux/reboot.h | 5 | ||||
| -rw-r--r-- | kernel/notifier.c | 31 | ||||
| -rw-r--r-- | kernel/sys.c | 32 |
6 files changed, 39 insertions, 36 deletions
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 271ff6318eda..0e0ea941156f 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
| 25 | #include <linux/memblock.h> | 25 | #include <linux/memblock.h> |
| 26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/reboot.h> | ||
| 27 | 28 | ||
| 28 | #include <asm/prom.h> | 29 | #include <asm/prom.h> |
| 29 | #include <asm/rtas.h> | 30 | #include <asm/rtas.h> |
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index bf5f5ce3a7bd..e037c7494fd8 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_fs.h> |
| 20 | #include <linux/reboot.h> | ||
| 20 | #include <asm/delay.h> | 21 | #include <asm/delay.h> |
| 21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
| 22 | #include <asm/rtas.h> | 23 | #include <asm/rtas.h> |
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index e8a858a1d391..145c43658db0 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
| @@ -189,10 +189,7 @@ static inline int notifier_to_errno(int ret) | |||
| 189 | 189 | ||
| 190 | /* netdevice notifiers are defined in include/linux/netdevice.h */ | 190 | /* netdevice notifiers are defined in include/linux/netdevice.h */ |
| 191 | 191 | ||
| 192 | #define SYS_DOWN 0x0001 /* Notify of system down */ | 192 | /* reboot notifiers are defined in include/linux/reboot.h. */ |
| 193 | #define SYS_RESTART SYS_DOWN | ||
| 194 | #define SYS_HALT 0x0002 /* Notify of system halt */ | ||
| 195 | #define SYS_POWER_OFF 0x0003 /* Notify of system power off */ | ||
| 196 | 193 | ||
| 197 | #define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */ | 194 | #define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */ |
| 198 | 195 | ||
diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 3005d5a7fce5..e0879a70e830 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h | |||
| @@ -39,6 +39,11 @@ | |||
| 39 | 39 | ||
| 40 | #include <linux/notifier.h> | 40 | #include <linux/notifier.h> |
| 41 | 41 | ||
| 42 | #define SYS_DOWN 0x0001 /* Notify of system down */ | ||
| 43 | #define SYS_RESTART SYS_DOWN | ||
| 44 | #define SYS_HALT 0x0002 /* Notify of system halt */ | ||
| 45 | #define SYS_POWER_OFF 0x0003 /* Notify of system power off */ | ||
| 46 | |||
| 42 | extern int register_reboot_notifier(struct notifier_block *); | 47 | extern int register_reboot_notifier(struct notifier_block *); |
| 43 | extern int unregister_reboot_notifier(struct notifier_block *); | 48 | extern int unregister_reboot_notifier(struct notifier_block *); |
| 44 | 49 | ||
diff --git a/kernel/notifier.c b/kernel/notifier.c index 2488ba7eb568..8d7b435806c9 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c | |||
| @@ -525,37 +525,6 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh) | |||
| 525 | } | 525 | } |
| 526 | EXPORT_SYMBOL_GPL(srcu_init_notifier_head); | 526 | EXPORT_SYMBOL_GPL(srcu_init_notifier_head); |
| 527 | 527 | ||
| 528 | /** | ||
| 529 | * register_reboot_notifier - Register function to be called at reboot time | ||
| 530 | * @nb: Info about notifier function to be called | ||
| 531 | * | ||
| 532 | * Registers a function with the list of functions | ||
| 533 | * to be called at reboot time. | ||
| 534 | * | ||
| 535 | * Currently always returns zero, as blocking_notifier_chain_register() | ||
| 536 | * always returns zero. | ||
| 537 | */ | ||
| 538 | int register_reboot_notifier(struct notifier_block *nb) | ||
| 539 | { | ||
| 540 | return blocking_notifier_chain_register(&reboot_notifier_list, nb); | ||
| 541 | } | ||
| 542 | EXPORT_SYMBOL(register_reboot_notifier); | ||
| 543 | |||
| 544 | /** | ||
| 545 | * unregister_reboot_notifier - Unregister previously registered reboot notifier | ||
| 546 | * @nb: Hook to be unregistered | ||
| 547 | * | ||
| 548 | * Unregisters a previously registered reboot | ||
| 549 | * notifier function. | ||
| 550 | * | ||
| 551 | * Returns zero on success, or %-ENOENT on failure. | ||
| 552 | */ | ||
| 553 | int unregister_reboot_notifier(struct notifier_block *nb) | ||
| 554 | { | ||
| 555 | return blocking_notifier_chain_unregister(&reboot_notifier_list, nb); | ||
| 556 | } | ||
| 557 | EXPORT_SYMBOL(unregister_reboot_notifier); | ||
| 558 | |||
| 559 | static ATOMIC_NOTIFIER_HEAD(die_chain); | 528 | static ATOMIC_NOTIFIER_HEAD(die_chain); |
| 560 | 529 | ||
| 561 | int notrace __kprobes notify_die(enum die_val val, const char *str, | 530 | int notrace __kprobes notify_die(enum die_val val, const char *str, |
diff --git a/kernel/sys.c b/kernel/sys.c index e4128b278f23..a101ba36c444 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
| 9 | #include <linux/utsname.h> | 9 | #include <linux/utsname.h> |
| 10 | #include <linux/mman.h> | 10 | #include <linux/mman.h> |
| 11 | #include <linux/notifier.h> | ||
| 12 | #include <linux/reboot.h> | 11 | #include <linux/reboot.h> |
| 13 | #include <linux/prctl.h> | 12 | #include <linux/prctl.h> |
| 14 | #include <linux/highuid.h> | 13 | #include <linux/highuid.h> |
| @@ -320,6 +319,37 @@ void kernel_restart_prepare(char *cmd) | |||
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | /** | 321 | /** |
| 322 | * register_reboot_notifier - Register function to be called at reboot time | ||
| 323 | * @nb: Info about notifier function to be called | ||
| 324 | * | ||
| 325 | * Registers a function with the list of functions | ||
| 326 | * to be called at reboot time. | ||
| 327 | * | ||
| 328 | * Currently always returns zero, as blocking_notifier_chain_register() | ||
| 329 | * always returns zero. | ||
| 330 | */ | ||
| 331 | int register_reboot_notifier(struct notifier_block *nb) | ||
| 332 | { | ||
| 333 | return blocking_notifier_chain_register(&reboot_notifier_list, nb); | ||
| 334 | } | ||
| 335 | EXPORT_SYMBOL(register_reboot_notifier); | ||
| 336 | |||
| 337 | /** | ||
| 338 | * unregister_reboot_notifier - Unregister previously registered reboot notifier | ||
| 339 | * @nb: Hook to be unregistered | ||
| 340 | * | ||
| 341 | * Unregisters a previously registered reboot | ||
| 342 | * notifier function. | ||
| 343 | * | ||
| 344 | * Returns zero on success, or %-ENOENT on failure. | ||
| 345 | */ | ||
| 346 | int unregister_reboot_notifier(struct notifier_block *nb) | ||
| 347 | { | ||
| 348 | return blocking_notifier_chain_unregister(&reboot_notifier_list, nb); | ||
| 349 | } | ||
| 350 | EXPORT_SYMBOL(unregister_reboot_notifier); | ||
| 351 | |||
| 352 | /** | ||
| 323 | * kernel_restart - reboot the system | 353 | * kernel_restart - reboot the system |
| 324 | * @cmd: pointer to buffer containing command to execute for restart | 354 | * @cmd: pointer to buffer containing command to execute for restart |
| 325 | * or %NULL | 355 | * or %NULL |
