@@ -109,7 +109,26 @@ static struct task_struct *power_task;
#define SYSCTL_FILENAME "sys/kernel/power"
/* soft power switch enabled/disabled */
-int pwrsw_enabled __read_mostly = 1;
+static int pwrsw_enabled __read_mostly = 1;
+#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 */
/* main kernel thread worker. It polls the button state */
static int kpowerswd(void *param)
@@ -193,7 +212,6 @@ static struct notifier_block parisc_panic_block = {
.priority = INT_MAX,
};
-
static int __init power_init(void)
{
unsigned long ret;
@@ -233,6 +251,8 @@ static int __init power_init(void)
atomic_notifier_chain_register(&panic_notifier_list,
&parisc_panic_block);
+ kernel_parisc_power_sysctls_init();
+
return 0;
}
@@ -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;
@@ -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",
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@uniontech.com> --- drivers/parisc/power.c | 24 ++++++++++++++++++++++-- include/linux/sysctl.h | 1 - kernel/sysctl.c | 9 --------- 3 files changed, 22 insertions(+), 12 deletions(-)