Skip to contentSkip to conversation

x86: simplify sysctl registrations

PATCH New Luis Chamberlain 1 participant 3 messages Mar 10, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover x86: simplify sysctl registrations

These are trivial conversions to reduce more code and avoid API calls that we are deprecating [0].

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

Luis Chamberlain (2):
x86: simplify one-level sysctl registration for abi_table2
x86: simplify one-level sysctl registration for itmt_kern_table

 arch/x86/entry/vdso/vdso32-setup.c | 11 +----------
 arch/x86/kernel/itmt.c             | 11 +----------
 2 files changed, 2 insertions(+), 20 deletions(-)
Signature · 1 line
2.39.1
#1 lore raw

PATCH 1/2 x86: simplify one-level sysctl registration for abi_table2

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/x86/entry/vdso/vdso32-setup.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
arch/x86/entry/vdso/vdso32-setup.c +1 -10
index 3b300a773c7e..f3b3cacbcbb0 100644
@@ -70,18 +70,9 @@ static struct ctl_table abi_table2[] = {
 	{}
 };
 
-static struct ctl_table abi_root_table2[] = {
-	{
-		.procname = "abi",
-		.mode = 0555,
-		.child = abi_table2
-	},
-	{}
-};
-
 static __init int ia32_binfmt_init(void)
 {
-	register_sysctl_table(abi_root_table2);
+	register_sysctl("abi", abi_table2);
 	return 0;
 }
 __initcall(ia32_binfmt_init);
Signature · 1 line
2.39.1
#2 lore raw

PATCH 2/2 x86: simplify one-level sysctl registration for itmt_kern_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/x86/kernel/itmt.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
arch/x86/kernel/itmt.c +1 -10
index 9ff480e94511..670eb08b972a 100644
@@ -77,15 +77,6 @@ static struct ctl_table itmt_kern_table[] = {
 	{}
 };
 
-static struct ctl_table itmt_root_table[] = {
-	{
-		.procname	= "kernel",
-		.mode		= 0555,
-		.child		= itmt_kern_table,
-	},
-	{}
-};
-
 static struct ctl_table_header *itmt_sysctl_header;
 
 /**
@@ -114,7 +105,7 @@ int sched_set_itmt_support(void)
 		return 0;
 	}
 
-	itmt_sysctl_header = register_sysctl_table(itmt_root_table);
+	itmt_sysctl_header = register_sysctl("kernel", itmt_kern_table);
 	if (!itmt_sysctl_header) {
 		mutex_unlock(&itmt_update_mutex);
 		return -ENOMEM;
Signature · 1 line
2.39.1