]> Git Repo - linux.git/commit - kernel/params.c
module: add extra argument for parse_params() callback
authorLuis R. Rodriguez <[email protected]>
Mon, 30 Mar 2015 23:20:03 +0000 (16:20 -0700)
committerGreg Kroah-Hartman <[email protected]>
Wed, 20 May 2015 07:25:24 +0000 (00:25 -0700)
commitecc8617053e0a97272ef2eee138809f30080e84b
treef9433e1dd51aea5b6f66db03460a9f2c1c3f4f4d
parent6570a9a1ce3a1dd227a065fd8ad16778d827b753
module: add extra argument for parse_params() callback

This adds an extra argument onto parse_params() to be used
as a way to make the unused callback a bit more useful and
generic by allowing the caller to pass on a data structure
of its choice. An example use case is to allow us to easily
make module parameters for every module which we will do
next.

@ parse @
identifier name, args, params, num, level_min, level_max;
identifier unknown, param, val, doing;
type s16;
@@
 extern char *parse_args(const char *name,
   char *args,
   const struct kernel_param *params,
   unsigned num,
   s16 level_min,
   s16 level_max,
+  void *arg,
   int (*unknown)(char *param, char *val,
const char *doing
+ , void *arg
));

@ parse_mod @
identifier name, args, params, num, level_min, level_max;
identifier unknown, param, val, doing;
type s16;
@@
 char *parse_args(const char *name,
   char *args,
   const struct kernel_param *params,
   unsigned num,
   s16 level_min,
   s16 level_max,
+  void *arg,
   int (*unknown)(char *param, char *val,
const char *doing
+ , void *arg
))
{
...
}

@ parse_args_found @
expression R, E1, E2, E3, E4, E5, E6;
identifier func;
@@

(
R =
parse_args(E1, E2, E3, E4, E5, E6,
+    NULL,
   func);
|
R =
parse_args(E1, E2, E3, E4, E5, E6,
+    NULL,
   &func);
|
R =
parse_args(E1, E2, E3, E4, E5, E6,
+    NULL,
   NULL);
|
parse_args(E1, E2, E3, E4, E5, E6,
+    NULL,
   func);
|
parse_args(E1, E2, E3, E4, E5, E6,
+    NULL,
   &func);
|
parse_args(E1, E2, E3, E4, E5, E6,
+    NULL,
   NULL);
)

@ parse_args_unused depends on parse_args_found @
identifier parse_args_found.func;
@@

int func(char *param, char *val, const char *unused
+  , void *arg
 )
{
...
}

@ mod_unused depends on parse_args_found @
identifier parse_args_found.func;
expression A1, A2, A3;
@@

- func(A1, A2, A3);
+ func(A1, A2, A3, NULL);

Generated-by: Coccinelle SmPL
Cc: [email protected]
Cc: Tejun Heo <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Felipe Contreras <[email protected]>
Cc: Ewan Milne <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: [email protected]
Reviewed-by: Tejun Heo <[email protected]>
Acked-by: Rusty Russell <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
arch/powerpc/mm/hugetlbpage.c
include/linux/moduleparam.h
init/main.c
kernel/module.c
kernel/params.c
lib/dynamic_debug.c
This page took 0.0621 seconds and 4 git commands to generate.