Commit c5f41752 authored by Amerigo Wang's avatar Amerigo Wang Committed by Linus Torvalds

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: default avatarWANG 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: default avatarWANG Cong <amwang@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dcfe1421
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/reboot.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/rtas.h> #include <asm/rtas.h>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/reboot.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/rtas.h> #include <asm/rtas.h>
......
...@@ -189,10 +189,7 @@ static inline int notifier_to_errno(int ret) ...@@ -189,10 +189,7 @@ static inline int notifier_to_errno(int ret)
/* netdevice notifiers are defined in include/linux/netdevice.h */ /* netdevice notifiers are defined in include/linux/netdevice.h */
#define SYS_DOWN 0x0001 /* Notify of system down */ /* reboot notifiers are defined in include/linux/reboot.h. */
#define SYS_RESTART SYS_DOWN
#define SYS_HALT 0x0002 /* Notify of system halt */
#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
#define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */ #define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */
......
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
#include <linux/notifier.h> #include <linux/notifier.h>
#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
#define SYS_HALT 0x0002 /* Notify of system halt */
#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
extern int register_reboot_notifier(struct notifier_block *); extern int register_reboot_notifier(struct notifier_block *);
extern int unregister_reboot_notifier(struct notifier_block *); extern int unregister_reboot_notifier(struct notifier_block *);
......
...@@ -525,37 +525,6 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh) ...@@ -525,37 +525,6 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh)
} }
EXPORT_SYMBOL_GPL(srcu_init_notifier_head); EXPORT_SYMBOL_GPL(srcu_init_notifier_head);
/**
* register_reboot_notifier - Register function to be called at reboot time
* @nb: Info about notifier function to be called
*
* Registers a function with the list of functions
* to be called at reboot time.
*
* Currently always returns zero, as blocking_notifier_chain_register()
* always returns zero.
*/
int register_reboot_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&reboot_notifier_list, nb);
}
EXPORT_SYMBOL(register_reboot_notifier);
/**
* unregister_reboot_notifier - Unregister previously registered reboot notifier
* @nb: Hook to be unregistered
*
* Unregisters a previously registered reboot
* notifier function.
*
* Returns zero on success, or %-ENOENT on failure.
*/
int unregister_reboot_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&reboot_notifier_list, nb);
}
EXPORT_SYMBOL(unregister_reboot_notifier);
static ATOMIC_NOTIFIER_HEAD(die_chain); static ATOMIC_NOTIFIER_HEAD(die_chain);
int notrace __kprobes notify_die(enum die_val val, const char *str, int notrace __kprobes notify_die(enum die_val val, const char *str,
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/mman.h> #include <linux/mman.h>
#include <linux/notifier.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/prctl.h> #include <linux/prctl.h>
#include <linux/highuid.h> #include <linux/highuid.h>
...@@ -319,6 +318,37 @@ void kernel_restart_prepare(char *cmd) ...@@ -319,6 +318,37 @@ void kernel_restart_prepare(char *cmd)
syscore_shutdown(); syscore_shutdown();
} }
/**
* register_reboot_notifier - Register function to be called at reboot time
* @nb: Info about notifier function to be called
*
* Registers a function with the list of functions
* to be called at reboot time.
*
* Currently always returns zero, as blocking_notifier_chain_register()
* always returns zero.
*/
int register_reboot_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&reboot_notifier_list, nb);
}
EXPORT_SYMBOL(register_reboot_notifier);
/**
* unregister_reboot_notifier - Unregister previously registered reboot notifier
* @nb: Hook to be unregistered
*
* Unregisters a previously registered reboot
* notifier function.
*
* Returns zero on success, or %-ENOENT on failure.
*/
int unregister_reboot_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&reboot_notifier_list, nb);
}
EXPORT_SYMBOL(unregister_reboot_notifier);
/** /**
* kernel_restart - reboot the system * kernel_restart - reboot the system
* @cmd: pointer to buffer containing command to execute for restart * @cmd: pointer to buffer containing command to execute for restart
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment