Move both uevent_helper table into lib/kobject_uevent.c. Place the
registration early in the initcall order with postcore_initcall.

This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kernel/sysctl.c.

Signed-off-by: Joel Granados <joel.grana...@kernel.org>
---
 kernel/sysctl.c      |  9 ---------
 lib/kobject_uevent.c | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 
0716c7df7243dc38f0a49c7cae78651c3f75f5a3..2df63b69edf6fd21a58584d670e75e6f26a6e5cc
 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1474,15 +1474,6 @@ static const struct ctl_table kern_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec,
        },
-#endif
-#ifdef CONFIG_UEVENT_HELPER
-       {
-               .procname       = "hotplug",
-               .data           = &uevent_helper,
-               .maxlen         = UEVENT_HELPER_PATH_LEN,
-               .mode           = 0644,
-               .proc_handler   = proc_dostring,
-       },
 #endif
        {
                .procname       = "overflowuid",
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 
b7f2fa08d9c82c2838b703f3fd25f6e43b88b68a..78e16b95d2101a01c442f62ad9b9133f3f8533c2
 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -826,3 +826,23 @@ static int __init kobject_uevent_init(void)
 
 postcore_initcall(kobject_uevent_init);
 #endif
+
+#ifdef CONFIG_UEVENT_HELPER
+static const struct ctl_table uevent_helper_sysctl_table[] = {
+       {
+               .procname       = "hotplug",
+               .data           = &uevent_helper,
+               .maxlen         = UEVENT_HELPER_PATH_LEN,
+               .mode           = 0644,
+               .proc_handler   = proc_dostring,
+       },
+};
+
+static int __init init_uevent_helper_sysctl(void)
+{
+       register_sysctl_init("kernel", uevent_helper_sysctl_table);
+       return 0;
+}
+
+postcore_initcall(init_uevent_helper_sysctl);
+#endif

-- 
2.47.2



Reply via email to