Luis Chamberlain
e5a1fd997c
i915: simplify subdirectory registration with register_sysctl()
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 PATH
@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
Link: https://lkml.kernel.org/r/20211123202422.819032-3-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Amir Goldstein <amir73il@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Antti Palosaari <crope@iki.fi>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: David Airlie <airlied@linux.ie>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Iurii Zaikin <yzaikin@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Kees Cook <keescook@chromium.org>
Cc: Lukas Middendorf <kernel@tuxforce.de>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Phillip Potter <phil@philpotter.co.uk>
Cc: Qing Wang <wangqing@vivo.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Stephen Kitt <steve@sk2.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Xiaoming Ni <nixiaoming@huawei.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: James E.J. Bottomley <jejb@linux.ibm.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-01-22 08:33:34 +02:00
..
2022-01-21 09:25:38 +02:00
2021-11-30 11:10:03 +01:00
2021-11-04 08:21:47 -07:00
2021-12-14 10:24:28 +01:00
2022-01-14 15:17:17 +01:00
2021-11-30 11:10:03 +01:00
2021-12-16 13:02:23 +01:00
2021-12-24 06:04:40 +10:00
2021-12-22 11:39:39 +09:00
2021-12-06 09:30:16 +01:00
2021-10-21 09:32:51 +02:00
2021-11-11 12:06:57 +01:00
2021-11-30 11:10:03 +01:00
2021-12-14 10:24:28 +01:00
2021-08-10 20:14:01 +02:00
2022-01-22 08:33:34 +02:00
2021-11-30 11:10:03 +01:00
2021-11-30 11:10:03 +01:00
2021-11-30 11:10:03 +01:00
2021-12-14 10:24:28 +01:00
2021-11-30 11:10:03 +01:00
2022-01-10 12:58:46 -08:00
2021-11-30 11:10:03 +01:00
2021-09-25 08:20:48 -07:00
2021-11-27 13:52:22 +01:00
2021-12-29 14:02:44 +10:00
2021-11-30 11:10:03 +01:00
2022-01-14 15:17:17 +01:00
2021-12-08 10:04:59 +02:00
2021-12-16 09:39:25 +01:00
2021-12-02 11:12:39 +01:00
2021-11-30 11:10:03 +01:00
2021-11-30 14:53:02 +01:00
2021-10-28 14:59:38 +10:00
2022-01-18 18:00:58 -05:00
2021-12-10 15:08:21 +10:00
2021-12-07 13:57:29 +01:00
2021-11-23 09:38:55 +10:00
2021-10-22 11:09:45 +02:00
2021-11-30 11:10:03 +01:00
2021-12-10 12:38:10 +01:00
2021-11-30 11:10:03 +01:00
2021-11-30 11:10:03 +01:00
2022-01-14 15:17:17 +01:00
2021-12-16 14:30:45 +01:00
2021-11-30 11:10:03 +01:00
2021-11-30 11:10:03 +01:00
2022-01-14 15:17:17 +01:00
2022-01-14 15:17:17 +01:00
2021-11-30 11:10:03 +01:00
2021-11-05 11:15:14 +01:00
2021-12-02 11:12:39 +01:00
2021-11-27 13:52:22 +01:00
2021-12-16 14:48:27 +01:00
2021-12-02 11:12:39 +01:00
2021-08-10 20:14:01 +02:00
2022-01-18 10:05:48 +02:00
2021-08-08 20:27:52 +02:00
2021-12-17 16:35:30 +01:00
2021-12-14 10:24:28 +01:00
2022-01-14 14:55:38 +01:00
2021-08-02 10:19:43 +02:00
2022-01-14 14:31:54 +01:00
2021-11-26 16:45:22 +01:00
2021-11-26 16:45:22 +01:00
2021-11-26 16:45:22 +01:00
2021-09-24 19:25:23 +02:00
2021-08-02 10:19:43 +02:00
2021-10-04 11:47:24 +02:00
2021-10-04 09:34:57 -04:00
2021-11-02 14:27:11 +01:00
2021-10-04 09:34:57 -04:00
2021-08-20 12:35:59 +02:00
2021-08-02 10:19:43 +02:00
2021-06-10 19:14:47 +02:00
2021-07-20 20:14:42 +02:00
2021-08-11 08:47:08 +10:00
2021-11-17 17:36:48 -05:00
2021-11-09 10:11:53 -08:00
2021-10-14 21:39:02 +02:00
2021-08-02 10:19:43 +02:00
2021-10-28 14:59:38 +10:00
2022-01-14 15:17:17 +01:00
2021-08-02 10:19:43 +02:00
2021-12-16 11:06:30 +01:00
2021-12-16 11:23:22 +01:00
2021-10-04 09:34:57 -04:00
2021-10-25 09:33:22 +02:00
2021-12-10 15:08:21 +10:00
2021-10-25 14:53:08 +02:00
2021-12-14 10:24:28 +01:00
2021-12-02 11:12:39 +01:00
2021-10-07 14:49:11 +02:00
2021-11-30 09:41:28 +01:00
2021-08-02 10:19:43 +02:00
2021-08-17 13:56:03 -04:00
2021-08-28 19:00:20 +02:00
2021-10-22 16:20:12 +02:00
2021-08-18 14:33:47 +02:00
2021-10-01 15:55:47 +02:00
2021-08-10 20:14:01 +02:00
2021-11-30 09:41:28 +01:00
2022-01-14 14:43:02 +01:00
2021-09-24 19:25:33 +02:00
2021-11-09 10:02:50 -08:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-11-11 08:14:19 +10:00
2021-11-27 21:05:58 +01:00
2021-10-14 20:47:30 +02:00
2021-11-18 11:42:08 +01:00
2021-07-13 06:38:37 -07:00
2021-10-07 12:24:44 +02:00
2021-08-02 10:19:43 +02:00
2021-11-12 12:11:07 -08:00
2021-08-19 09:02:55 +09:00
2021-10-14 13:12:24 +02:00
2021-10-14 13:12:25 +02:00
2021-11-02 14:27:14 +01:00
2021-10-07 05:42:13 +03:00
2021-08-02 10:19:43 +02:00
2021-08-08 20:14:08 +02:00
2021-12-08 17:19:48 +01:00
2021-11-02 14:27:06 +01:00
2021-08-10 20:14:01 +02:00
2021-08-02 10:19:43 +02:00
2021-12-10 12:36:52 +01:00
2021-12-10 12:36:52 +01:00