[PATCH] reboot: move reboot_notifier_list to kernel/reboot.c

From: Thomas Weißschuh
Date: Sat Oct 12 2024 - 13:54:16 EST


All the functions related to the reboot notifier list are in
kernel/reboot.c. Move the list itself, too.
As there are no direct users anymore, make the declaration static.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
include/linux/notifier.h | 2 --
kernel/notifier.c | 8 --------
kernel/reboot.c | 7 +++++++
3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 45702bdcbceb4aa5e42ad7e0fafd71eaf74be9a5..b42e647349688248d8e45e90f997eaca9954c009 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -237,7 +237,5 @@ static inline int notifier_to_errno(int ret)
#define KBD_KEYSYM 0x0004 /* Keyboard keysym */
#define KBD_POST_KEYSYM 0x0005 /* Called after keyboard keysym interpretation */

-extern struct blocking_notifier_head reboot_notifier_list;
-
#endif /* __KERNEL__ */
#endif /* _LINUX_NOTIFIER_H */
diff --git a/kernel/notifier.c b/kernel/notifier.c
index b3ce28f39eb654663eb934cb2d288632c5a56022..2f9fe7c30287f428654112a4956b44129c3ddb16 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -5,18 +5,10 @@
#include <linux/notifier.h>
#include <linux/rcupdate.h>
#include <linux/vmalloc.h>
-#include <linux/reboot.h>

#define CREATE_TRACE_POINTS
#include <trace/events/notifier.h>

-/*
- * Notifier list for kernel code which wants to be called
- * at shutdown. This is used to stop any idling DMA operations
- * and the like.
- */
-BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
-
/*
* Notifier chain core routines. The exported routines below
* are layered on top of these, with appropriate locking added.
diff --git a/kernel/reboot.c b/kernel/reboot.c
index f05dbde2c93fe709ff01491e8a31e0b3c7b66744..ffdf86b717abc0d869a81e1109eaef1e53a5937c 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -72,6 +72,13 @@ static bool poweroff_fallback_to_halt;
*/
void __weak (*pm_power_off)(void);

+/*
+ * Notifier list for kernel code which wants to be called
+ * at shutdown. This is used to stop any idling DMA operations
+ * and the like.
+ */
+static BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
+
/**
* emergency_restart - reboot the system
*

---
base-commit: 7234e2ea0edd00bfb6bb2159e55878c19885ce68
change-id: 20241012-reboot_notifier_list-376769e2e6bf

Best regards,
--
Thomas Weißschuh <linux@xxxxxxxxxxxxxx>