diff options
| author | Joel Granados <joel.granados@kernel.org> | 2025-05-02 15:32:17 +0200 |
|---|---|---|
| committer | Joel Granados <joel.granados@kernel.org> | 2025-07-23 11:52:48 +0200 |
| commit | 9e2f403dd8c2b07aff012e72c1fe5455538d72d2 (patch) | |
| tree | f2293b4aa292fe38dd1d00c4d8283b76be559075 | |
| parent | 851911aa7210ca27f007bd79553172e2e3ba8723 (diff) | |
parisc/power: Move soft-power into power.c
Move the soft-power ctl table into parisc/power.c. As a consequence the
pwrsw_enabled var is made static.
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.
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
| -rw-r--r-- | drivers/parisc/power.c | 20 | ||||
| -rw-r--r-- | include/linux/sysctl.h | 1 | ||||
| -rw-r--r-- | kernel/sysctl.c | 9 |
3 files changed, 19 insertions, 11 deletions
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c index 7a6a3e7f2825..9d6c7bf72e29 100644 --- a/drivers/parisc/power.c +++ b/drivers/parisc/power.c @@ -83,7 +83,25 @@ 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; + +static const struct ctl_table power_sysctl_table[] = { + { + .procname = "soft-power", + .data = &pwrsw_enabled, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, +}; + +static int __init init_power_sysctl(void) +{ + register_sysctl_init("kernel", power_sysctl_table); + return 0; +} + +arch_initcall(init_power_sysctl); /* main kernel thread worker. It polls the button state */ static int kpowerswd(void *param) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 40a6ac6c9713..ae762eabb7c9 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -242,7 +242,6 @@ int do_proc_douintvec(const 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 adc2d3ea1278..718140251972 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1594,15 +1594,6 @@ static const struct ctl_table kern_table[] = { .extra2 = SYSCTL_ONE, }, #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", |
