Skip to contentSkip to conversation

ppc: simplify sysctl registration

PATCH Applied Luis Chamberlain 2 participants 4 messages Mar 10, 2023 – Mar 22, 2023

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/2 ppc: simplify one-level sysctl registration for powersave_nap_ctl_table

In reply to Luis Chamberlain

There is no need to declare an extra tables to just create directory, this can be easily be done with a prefix path with register_sysctl().

Simplify this registration.

---
 arch/powerpc/kernel/idle.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
arch/powerpc/kernel/idle.c +1 -9
index b9a725abc596..b1c0418b25c8 100644
@@ -107,19 +107,11 @@ static struct ctl_table powersave_nap_ctl_table[] = {
 	},
 	{}
 };
-static struct ctl_table powersave_nap_sysctl_root[] = {
-	{
-		.procname	= "kernel",
-		.mode		= 0555,
-		.child		= powersave_nap_ctl_table,
-	},
-	{}
-};
 
 static int __init
 register_powersave_nap_sysctl(void)
 {
-	register_sysctl_table(powersave_nap_sysctl_root);
+	register_sysctl("kernel", powersave_nap_ctl_table);
 
 	return 0;
 }
Signature · 1 line
2.39.1
#0 lore raw

cover ppc: simplify sysctl registration

We can simplify the way we do sysctl registration both by reducing the number of lines and also avoiding calllers which could do recursion. The docs are being updated to help reflect this better [0].

[0] https://lore.kernel.org/all/[email protected]/T/#u

Luis Chamberlain (2):
ppc: simplify one-level sysctl registration for
powersave_nap_ctl_table
ppc: simplify one-level sysctl registration for
nmi_wd_lpm_factor_ctl_table

 arch/powerpc/kernel/idle.c                | 10 +---------
 arch/powerpc/platforms/pseries/mobility.c | 10 +---------
 2 files changed, 2 insertions(+), 18 deletions(-)
Signature · 1 line
2.39.1
#2 lore raw

PATCH 2/2 ppc: simplify one-level sysctl registration for nmi_wd_lpm_factor_ctl_table

There is no need to declare an extra tables to just create directory, this can be easily be done with a prefix path with register_sysctl().

Simplify this registration.

---
 arch/powerpc/platforms/pseries/mobility.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
arch/powerpc/platforms/pseries/mobility.c +1 -9
index 4cea71aa0f41..2b58e76abef8 100644
@@ -62,18 +62,10 @@ static struct ctl_table nmi_wd_lpm_factor_ctl_table[] = {
 	},
 	{}
 };
-static struct ctl_table nmi_wd_lpm_factor_sysctl_root[] = {
-	{
-		.procname       = "kernel",
-		.mode           = 0555,
-		.child          = nmi_wd_lpm_factor_ctl_table,
-	},
-	{}
-};
 
 static int __init register_nmi_wd_lpm_factor_sysctl(void)
 {
-	register_sysctl_table(nmi_wd_lpm_factor_sysctl_root);
+	register_sysctl("kernel", nmi_wd_lpm_factor_ctl_table);
 
 	return 0;
 }
Signature · 1 line
2.39.1
#3 lore raw
In reply to Luis Chamberlain
Quoted 8 lines · Luis Chamberlain

We can simplify the way we do sysctl registration both by reducing the number of lines and also avoiding calllers which could do recursion. The docs are being updated to help reflect this better [0].

[0] https://lore.kernel.org/all/[email protected]/T/#u

[...]

Applied to powerpc/next.

[1/2] ppc: simplify one-level sysctl registration for powersave_nap_ctl_table

      https://git.kernel.org/powerpc/c/bfedee5dc406ddcd70d667be1501659f1b232b7f
[2/2] ppc: simplify one-level sysctl registration for nmi_wd_lpm_factor_ctl_table
      https://git.kernel.org/powerpc/c/3a713753d3cb52e4e3039cdb906ef00f0b574219

cheers