Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Amerigo Wang and committed by
Linus Torvalds
c5f41752 dcfe1421

+39 -36
+1
arch/powerpc/kernel/rtas.c
··· 24 24 #include <linux/cpumask.h> 25 25 #include <linux/memblock.h> 26 26 #include <linux/slab.h> 27 + #include <linux/reboot.h> 27 28 28 29 #include <asm/prom.h> 29 30 #include <asm/rtas.h>
+1
arch/powerpc/kernel/rtas_flash.c
··· 17 17 #include <linux/init.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/proc_fs.h> 20 + #include <linux/reboot.h> 20 21 #include <asm/delay.h> 21 22 #include <asm/uaccess.h> 22 23 #include <asm/rtas.h>
+1 -4
include/linux/notifier.h
··· 189 189 190 190 /* netdevice notifiers are defined in include/linux/netdevice.h */ 191 191 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. */ 196 193 197 194 #define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */ 198 195
+5
include/linux/reboot.h
··· 39 39 40 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 47 extern int register_reboot_notifier(struct notifier_block *); 43 48 extern int unregister_reboot_notifier(struct notifier_block *); 44 49
-31
kernel/notifier.c
··· 525 525 } 526 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 528 static ATOMIC_NOTIFIER_HEAD(die_chain); 560 529 561 530 int notrace __kprobes notify_die(enum die_val val, const char *str,
+31 -1
kernel/sys.c
··· 8 8 #include <linux/mm.h> 9 9 #include <linux/utsname.h> 10 10 #include <linux/mman.h> 11 - #include <linux/notifier.h> 12 11 #include <linux/reboot.h> 13 12 #include <linux/prctl.h> 14 13 #include <linux/highuid.h> ··· 317 318 device_shutdown(); 318 319 syscore_shutdown(); 319 320 } 321 + 322 + /** 323 + * register_reboot_notifier - Register function to be called at reboot time 324 + * @nb: Info about notifier function to be called 325 + * 326 + * Registers a function with the list of functions 327 + * to be called at reboot time. 328 + * 329 + * Currently always returns zero, as blocking_notifier_chain_register() 330 + * always returns zero. 331 + */ 332 + int register_reboot_notifier(struct notifier_block *nb) 333 + { 334 + return blocking_notifier_chain_register(&reboot_notifier_list, nb); 335 + } 336 + EXPORT_SYMBOL(register_reboot_notifier); 337 + 338 + /** 339 + * unregister_reboot_notifier - Unregister previously registered reboot notifier 340 + * @nb: Hook to be unregistered 341 + * 342 + * Unregisters a previously registered reboot 343 + * notifier function. 344 + * 345 + * Returns zero on success, or %-ENOENT on failure. 346 + */ 347 + int unregister_reboot_notifier(struct notifier_block *nb) 348 + { 349 + return blocking_notifier_chain_unregister(&reboot_notifier_list, nb); 350 + } 351 + EXPORT_SYMBOL(unregister_reboot_notifier); 320 352 321 353 /** 322 354 * kernel_restart - reboot the system