[PATCH 01/11] kernel/parisc: move soft-power sysctl to its own file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.

To help with this maintenance let's start by moving sysctls to places
where they actually belong.  The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.

All filesystem syctls now get reviewed by fs folks. This commit
follows the commit of fs, move the soft-power sysctl to its own file,
kernel/parisc/power.c.

Signed-off-by: tangmeng <tangmeng@xxxxxxxxxxxxx>
---
 drivers/parisc/power.c | 22 ++++++++++++++++++++++
 include/linux/sysctl.h |  1 -
 kernel/sysctl.c        |  9 ---------
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 456776bd8ee6..24e0ffbe460a 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -193,6 +193,26 @@ static struct notifier_block parisc_panic_block = {
 	.priority	= INT_MAX,
 };
 
+static int pwrsw_enabled;
+#ifdef CONFIG_SYSCTL
+static struct ctl_table kern_parisc_power_table[] = {
+	{
+		.procname       = "soft-power",
+		.data           = &pwrsw_enabled,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = proc_dointvec,
+	},
+	{ }
+};
+
+static void __init kernel_parisc_power_sysctls_init(void)
+{
+	register_sysctl_init("kernel", kern_parisc_power_table);
+}
+#else
+#define kernel_parisc_power_sysctls_init() do { } while (0)
+#endif /* CONFIG_SYSCTL */
 
 static int __init power_init(void)
 {
@@ -233,6 +253,8 @@ static int __init power_init(void)
 	atomic_notifier_chain_register(&panic_notifier_list,
 			&parisc_panic_block);
 
+	kernel_parisc_power_sysctls_init();
+
 	return 0;
 }
 
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 6353d6db69b2..e00bf436d63b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -242,7 +242,6 @@ int do_proc_douintvec(struct ctl_table *table, int write,
 				  int write, void *data),
 		      void *data);
 
-extern int pwrsw_enabled;
 extern int unaligned_enabled;
 extern int unaligned_dump_stack;
 extern int no_unaligned_warning;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 22037f03cd2b..d11390634321 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1737,15 +1737,6 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
-#ifdef CONFIG_PARISC
-	{
-		.procname	= "soft-power",
-		.data		= &pwrsw_enabled,
-		.maxlen		= sizeof (int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif
 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
 	{
 		.procname	= "unaligned-trap",
-- 
2.20.1






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux