Skip to content

Commit bc4f328

Browse files
committed
sparc: mv sparc sysctls into their own file under arch/sparc/kernel
Move sparc sysctls (reboot-cmd, stop-a, scons-poweroff and tsb-ratio) into a new file (arch/sparc/kernel/setup.c). This file will be included for both 32 and 64 bit sparc. Leave "tsb-ratio" under SPARC64 ifdef as it was in kernel/sysctl.c. The sysctl table register is called with arch_initcall placing it after its original place in proc_root_init. 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.granados@kernel.org>
1 parent 67049b5 commit bc4f328

File tree

3 files changed

+47
-35
lines changed

3 files changed

+47
-35
lines changed

arch/sparc/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ obj-y += process.o
3535
obj-y += signal_$(BITS).o
3636
obj-y += sigutil_$(BITS).o
3737
obj-$(CONFIG_SPARC32) += ioport.o
38+
obj-y += setup.o
3839
obj-y += setup_$(BITS).o
3940
obj-y += idprom.o
4041
obj-y += sys_sparc_$(BITS).o

arch/sparc/kernel/setup.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
#include <asm/setup.h>
4+
#include <linux/sysctl.h>
5+
6+
static const struct ctl_table sparc_sysctl_table[] = {
7+
{
8+
.procname = "reboot-cmd",
9+
.data = reboot_command,
10+
.maxlen = 256,
11+
.mode = 0644,
12+
.proc_handler = proc_dostring,
13+
},
14+
{
15+
.procname = "stop-a",
16+
.data = &stop_a_enabled,
17+
.maxlen = sizeof(int),
18+
.mode = 0644,
19+
.proc_handler = proc_dointvec,
20+
},
21+
{
22+
.procname = "scons-poweroff",
23+
.data = &scons_pwroff,
24+
.maxlen = sizeof(int),
25+
.mode = 0644,
26+
.proc_handler = proc_dointvec,
27+
},
28+
#ifdef CONFIG_SPARC64
29+
{
30+
.procname = "tsb-ratio",
31+
.data = &sysctl_tsb_ratio,
32+
.maxlen = sizeof(int),
33+
.mode = 0644,
34+
.proc_handler = proc_dointvec,
35+
},
36+
#endif
37+
};
38+
39+
40+
static int __init init_sparc_sysctls(void)
41+
{
42+
register_sysctl_init("kernel", sparc_sysctl_table);
43+
return 0;
44+
}
45+
46+
arch_initcall(init_sparc_sysctls);

kernel/sysctl.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060
#include <asm/nmi.h>
6161
#include <asm/io.h>
6262
#endif
63-
#ifdef CONFIG_SPARC
64-
#include <asm/setup.h>
65-
#endif
6663
#ifdef CONFIG_RT_MUTEXES
6764
#include <linux/rtmutex.h>
6865
#endif
@@ -1601,38 +1598,6 @@ static const struct ctl_table kern_table[] = {
16011598
.extra2 = SYSCTL_ONE,
16021599
},
16031600
#endif
1604-
#ifdef CONFIG_SPARC
1605-
{
1606-
.procname = "reboot-cmd",
1607-
.data = reboot_command,
1608-
.maxlen = 256,
1609-
.mode = 0644,
1610-
.proc_handler = proc_dostring,
1611-
},
1612-
{
1613-
.procname = "stop-a",
1614-
.data = &stop_a_enabled,
1615-
.maxlen = sizeof (int),
1616-
.mode = 0644,
1617-
.proc_handler = proc_dointvec,
1618-
},
1619-
{
1620-
.procname = "scons-poweroff",
1621-
.data = &scons_pwroff,
1622-
.maxlen = sizeof (int),
1623-
.mode = 0644,
1624-
.proc_handler = proc_dointvec,
1625-
},
1626-
#endif
1627-
#ifdef CONFIG_SPARC64
1628-
{
1629-
.procname = "tsb-ratio",
1630-
.data = &sysctl_tsb_ratio,
1631-
.maxlen = sizeof (int),
1632-
.mode = 0644,
1633-
.proc_handler = proc_dointvec,
1634-
},
1635-
#endif
16361601
#ifdef CONFIG_PARISC
16371602
{
16381603
.procname = "soft-power",

0 commit comments

Comments
 (0)