Skip to content

Commit 9e2f403

Browse files
committed
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 <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Joel Granados <[email protected]>
1 parent 851911a commit 9e2f403

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

drivers/parisc/power.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,25 @@ static struct task_struct *power_task;
8383
#define SYSCTL_FILENAME "sys/kernel/power"
8484

8585
/* soft power switch enabled/disabled */
86-
int pwrsw_enabled __read_mostly = 1;
86+
static int pwrsw_enabled __read_mostly = 1;
87+
88+
static const struct ctl_table power_sysctl_table[] = {
89+
{
90+
.procname = "soft-power",
91+
.data = &pwrsw_enabled,
92+
.maxlen = sizeof(int),
93+
.mode = 0644,
94+
.proc_handler = proc_dointvec,
95+
},
96+
};
97+
98+
static int __init init_power_sysctl(void)
99+
{
100+
register_sysctl_init("kernel", power_sysctl_table);
101+
return 0;
102+
}
103+
104+
arch_initcall(init_power_sysctl);
87105

88106
/* main kernel thread worker. It polls the button state */
89107
static int kpowerswd(void *param)

include/linux/sysctl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ int do_proc_douintvec(const struct ctl_table *table, int write,
242242
int write, void *data),
243243
void *data);
244244

245-
extern int pwrsw_enabled;
246245
extern int unaligned_enabled;
247246
extern int unaligned_dump_stack;
248247
extern int no_unaligned_warning;

kernel/sysctl.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,15 +1594,6 @@ static const struct ctl_table kern_table[] = {
15941594
.extra2 = SYSCTL_ONE,
15951595
},
15961596
#endif
1597-
#ifdef CONFIG_PARISC
1598-
{
1599-
.procname = "soft-power",
1600-
.data = &pwrsw_enabled,
1601-
.maxlen = sizeof (int),
1602-
.mode = 0644,
1603-
.proc_handler = proc_dointvec,
1604-
},
1605-
#endif
16061597
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
16071598
{
16081599
.procname = "unaligned-trap",

0 commit comments

Comments
 (0)