File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424#include <linux/cpumask.h>
2525#include <linux/memblock.h>
2626#include <linux/slab.h>
27+ #include <linux/reboot.h>
2728
2829#include <asm/prom.h>
2930#include <asm/rtas.h>
Original file line number Diff line number Diff line change 1717#include <linux/init.h>
1818#include <linux/slab.h>
1919#include <linux/proc_fs.h>
20+ #include <linux/reboot.h>
2021#include <asm/delay.h>
2122#include <asm/uaccess.h>
2223#include <asm/rtas.h>
Original file line number Diff line number Diff line change @@ -189,10 +189,7 @@ static inline int notifier_to_errno(int ret)
189189
190190/* netdevice notifiers are defined in include/linux/netdevice.h */
191191
192- #define SYS_DOWN 0x0001 /* Notify of system down */
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 */
192+ /* reboot notifiers are defined in include/linux/reboot.h. */
196193
197194#define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */
198195
Original file line number Diff line number Diff line change 3939
4040#include <linux/notifier.h>
4141
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+
4247extern int register_reboot_notifier (struct notifier_block * );
4348extern int unregister_reboot_notifier (struct notifier_block * );
4449
Original file line number Diff line number Diff line change @@ -525,37 +525,6 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh)
525525}
526526EXPORT_SYMBOL_GPL (srcu_init_notifier_head );
527527
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-
559528static ATOMIC_NOTIFIER_HEAD (die_chain );
560529
561530int notrace __kprobes notify_die (enum die_val val , const char * str ,
Original file line number Diff line number Diff line change 88#include <linux/mm.h>
99#include <linux/utsname.h>
1010#include <linux/mman.h>
11- #include <linux/notifier.h>
1211#include <linux/reboot.h>
1312#include <linux/prctl.h>
1413#include <linux/highuid.h>
@@ -319,6 +318,37 @@ void kernel_restart_prepare(char *cmd)
319318 syscore_shutdown ();
320319}
321320
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+
322352/**
323353 * kernel_restart - reboot the system
324354 * @cmd: pointer to buffer containing command to execute for restart
You can’t perform that action at this time.
0 commit comments