[PATCH] crypto: simplify one-level sysctl registration for crypto_sysctl_table

Luis Chamberlain posted 1 patch 2 years, 11 months ago
crypto/fips.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
[PATCH] crypto: simplify one-level sysctl registration for crypto_sysctl_table
Posted by Luis Chamberlain 2 years, 11 months ago
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>
---

If not clear, see this new doc:

https://lore.kernel.org/all/20230310223947.3917711-1-mcgrof@kernel.org/T/#u     

But the skinny is we can deprecate long term APIs from sysctl that
uses recursion.

 crypto/fips.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/crypto/fips.c b/crypto/fips.c
index b05d3c7b3ca5..92fd506abb21 100644
--- a/crypto/fips.c
+++ b/crypto/fips.c
@@ -66,20 +66,11 @@ static struct ctl_table crypto_sysctl_table[] = {
 	{}
 };
 
-static struct ctl_table crypto_dir_table[] = {
-	{
-		.procname       = "crypto",
-		.mode           = 0555,
-		.child          = crypto_sysctl_table
-	},
-	{}
-};
-
 static struct ctl_table_header *crypto_sysctls;
 
 static void crypto_proc_fips_init(void)
 {
-	crypto_sysctls = register_sysctl_table(crypto_dir_table);
+	crypto_sysctls = register_sysctl("crypto", crypto_sysctl_table);
 }
 
 static void crypto_proc_fips_exit(void)
-- 
2.39.1
Re: [PATCH] crypto: simplify one-level sysctl registration for crypto_sysctl_table
Posted by Herbert Xu 2 years, 11 months ago
On Fri, Mar 10, 2023 at 03:21:50PM -0800, Luis Chamberlain wrote:
> 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>
> ---
> 
> If not clear, see this new doc:
> 
> https://lore.kernel.org/all/20230310223947.3917711-1-mcgrof@kernel.org/T/#u     
> 
> But the skinny is we can deprecate long term APIs from sysctl that
> uses recursion.
> 
>  crypto/fips.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt