linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ppc: simplify sysctl registration
@ 2023-03-10 23:28 Luis Chamberlain
  2023-03-10 23:28 ` [PATCH 1/2] ppc: simplify one-level sysctl registration for powersave_nap_ctl_table Luis Chamberlain
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:28 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: j.granados, keescook, patches, linux-kernel, Luis Chamberlain,
	ebiederm, linux-fsdevel, yzaikin, linuxppc-dev

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/20230310223947.3917711-1-mcgrof@kernel.org/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(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ppc: simplify one-level sysctl registration for powersave_nap_ctl_table
  2023-03-10 23:28 [PATCH 0/2] ppc: simplify sysctl registration Luis Chamberlain
@ 2023-03-10 23:28 ` Luis Chamberlain
  2023-03-10 23:28 ` [PATCH 2/2] ppc: simplify one-level sysctl registration for nmi_wd_lpm_factor_ctl_table Luis Chamberlain
  2023-03-22 12:25 ` [PATCH 0/2] ppc: simplify sysctl registration Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:28 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: j.granados, keescook, patches, linux-kernel, Luis Chamberlain,
	ebiederm, linux-fsdevel, yzaikin, linuxppc-dev

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.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 arch/powerpc/kernel/idle.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index b9a725abc596..b1c0418b25c8 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -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;
 }
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ppc: simplify one-level sysctl registration for nmi_wd_lpm_factor_ctl_table
  2023-03-10 23:28 [PATCH 0/2] ppc: simplify sysctl registration Luis Chamberlain
  2023-03-10 23:28 ` [PATCH 1/2] ppc: simplify one-level sysctl registration for powersave_nap_ctl_table Luis Chamberlain
@ 2023-03-10 23:28 ` Luis Chamberlain
  2023-03-22 12:25 ` [PATCH 0/2] ppc: simplify sysctl registration Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2023-03-10 23:28 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: j.granados, keescook, patches, linux-kernel, Luis Chamberlain,
	ebiederm, linux-fsdevel, yzaikin, linuxppc-dev

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.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 arch/powerpc/platforms/pseries/mobility.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 4cea71aa0f41..2b58e76abef8 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -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;
 }
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ppc: simplify sysctl registration
  2023-03-10 23:28 [PATCH 0/2] ppc: simplify sysctl registration Luis Chamberlain
  2023-03-10 23:28 ` [PATCH 1/2] ppc: simplify one-level sysctl registration for powersave_nap_ctl_table Luis Chamberlain
  2023-03-10 23:28 ` [PATCH 2/2] ppc: simplify one-level sysctl registration for nmi_wd_lpm_factor_ctl_table Luis Chamberlain
@ 2023-03-22 12:25 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2023-03-22 12:25 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, Luis Chamberlain
  Cc: j.granados, keescook, patches, linux-kernel, ebiederm,
	linux-fsdevel, yzaikin, linuxppc-dev

On Fri, 10 Mar 2023 15:28:48 -0800, Luis Chamberlain wrote:
> 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/20230310223947.3917711-1-mcgrof@kernel.org/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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-22 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 23:28 [PATCH 0/2] ppc: simplify sysctl registration Luis Chamberlain
2023-03-10 23:28 ` [PATCH 1/2] ppc: simplify one-level sysctl registration for powersave_nap_ctl_table Luis Chamberlain
2023-03-10 23:28 ` [PATCH 2/2] ppc: simplify one-level sysctl registration for nmi_wd_lpm_factor_ctl_table Luis Chamberlain
2023-03-22 12:25 ` [PATCH 0/2] ppc: simplify sysctl registration Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).