Skip to contentSkip to conversation

hpet-simplify-subdirectory-registration-with-register_sysctl.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jan 23, 2022

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: hpet: simplify subdirectory registration with register_sysctl()
has been removed from the -mm tree. Its filename was
hpet-simplify-subdirectory-registration-with-register_sysctl.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Luis Chamberlain <[email protected]>
Subject: hpet: simplify subdirectory registration with register_sysctl()

Patch series "sysctl: second set of kernel/sysctl cleanups", v2.

This is the 2nd set of kernel/sysctl.c cleanups. The diff stat should reflect how this is a much better way to deal with theses. Fortunately coccinelle can be used to ensure correctness for most of these and/or future merge conflicts.

Note that since this is part of a larger effort to cleanup kernel/sysctl.c I think we have no other option but to go with merging these patches in either Andrew's tree or keep them staged in a separate tree and send a merge request later. Otherwise kernel/sysctl.c will end up becoming a sore spot for the next merge window.

This patch (of 8):

There is no need to user boiler plate code to specify a set of base directories we're going to stuff sysctls under. Simplify this by using register_sysctl() and specifying the directory path directly.

// pycocci sysctl-subdir-register-sysctl-simplify.cocci drivers/char/hpet.c

@c1@
expression E1;
identifier subdir, sysctls;
@@

static struct ctl_table subdir[] = {
	{
		.procname = E1,
		.maxlen = 0,
		.mode = 0555,
		.child = sysctls,
	},
	{ }
};

@c2@
identifier c1.subdir;

expression E2;
identifier base;
@@

static struct ctl_table base[] = {
	{
		.procname = E2,
		.maxlen = 0,
		.mode = 0555,
		.child = subdir,
	},
	{ }
};

@c3@
identifier c2.base;
identifier header;
@@

header = register_sysctl_table(base);

@r1 depends on c1 && c2 && c3@
expression c1.E1;
identifier c1.subdir, c1.sysctls;
@@

-static struct ctl_table subdir[] = {
- {
- .procname = E1,
- .maxlen = 0,
- .mode = 0555,
- .child = sysctls,
- },
- { }
-};

@r2 depends on c1 && c2 && c3@
identifier c1.subdir;

expression c2.E2;
identifier c2.base;
@@
-static struct ctl_table base[] = {
- {
- .procname = E2,
- .maxlen = 0,
- .mode = 0555,
- .child = subdir,
- },
- { }
-};

@initialize:python@
@@

def make_my_fresh_expression(s1, s2):
return '"' + s1.strip('"') + "/" + s2.strip('"') + '"'

@r3 depends on c1 && c2 && c3@
expression c1.E1;
identifier c1.sysctls;
expression c2.E2;
identifier c2.base;
identifier c3.header;
fresh identifier E3 = script:python(E2, E1) { make_my_fresh_expression(E2, E1) }; @@

header =
-register_sysctl_table(base);
+register_sysctl(E3, sysctls);

Generated-by: Coccinelle SmPL

Cc Kees Cook <[email protected]>
Cc Iurii Zaikin <[email protected]>
Cc Xiaoming Ni <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Clemens Ladisch <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc David Airlie <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Mark Fasheh <[email protected]>
Cc Joel Becker <[email protected]>
Cc Joseph Qi <[email protected]>
Cc Jan Kara <[email protected]>
Cc Amir Goldstein <[email protected]>
Cc Phillip Potter <[email protected]>
Cc Al Viro <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Lukas Middendorf <[email protected]>
Cc Antti Palosaari <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Benjamin LaHaise <[email protected]>
Cc Paul Turner <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Qing Wang <[email protected]>
Cc Sebastian Reichel <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Stephen Kitt <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc Douglas Gilbert <[email protected]>
Cc James E.J. Bottomley <[email protected]>
Cc Jani Nikula <[email protected]>
Cc John Ogness <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Steven Rostedt (VMware) <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc "Theodore Ts'o" <[email protected]>

---

 drivers/char/hpet.c |   22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)
drivers/char/hpet.c renamed from drivers/char/hpet.c~hpet-simplify-subdirectory-registration-with-register_sysctl +1 -21
@@ -746,26 +746,6 @@ static struct ctl_table hpet_table[] = {
 	{}
 };
 
-static struct ctl_table hpet_root[] = {
-	{
-	 .procname = "hpet",
-	 .maxlen = 0,
-	 .mode = 0555,
-	 .child = hpet_table,
-	 },
-	{}
-};
-
-static struct ctl_table dev_root[] = {
-	{
-	 .procname = "dev",
-	 .maxlen = 0,
-	 .mode = 0555,
-	 .child = hpet_root,
-	 },
-	{}
-};
-
 static struct ctl_table_header *sysctl_header;
 
 /*
@@ -1061,7 +1041,7 @@ static int __init hpet_init(void)
 	if (result < 0)
 		return -ENODEV;
 
-	sysctl_header = register_sysctl_table(dev_root);
+	sysctl_header = register_sysctl("dev/hpet", hpet_table);
 
 	result = acpi_bus_register_driver(&hpet_acpi_driver);
 	if (result < 0) {

_

Patches currently in -mm which might be from [email protected] are