Commit ae82fdb1 authored by Rusty Russell's avatar Rusty Russell

module_param: stop double-calling parameters.

Commit 026cee00 "params:
<level>_initcall-like kernel parameters" set old-style module
parameters to level 0.  And we call those level 0 calls where we used
to, early in start_kernel().

We also loop through the initcall levels and call the levelled
module_params before the corresponding initcall.  Unfortunately level
0 is early_init(), so we call the standard module_param calls twice.

(Turns out most things don't care, but at least ubi.mtd does).

Change the level to -1 for standard module_param calls.
Reported-by: default avatarBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
parent f8f5701b
...@@ -128,7 +128,7 @@ struct kparam_array ...@@ -128,7 +128,7 @@ struct kparam_array
* The ops can have NULL set or get functions. * The ops can have NULL set or get functions.
*/ */
#define module_param_cb(name, ops, arg, perm) \ #define module_param_cb(name, ops, arg, perm) \
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0) __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1)
/** /**
* <level>_param_cb - general callback for a module/cmdline parameter * <level>_param_cb - general callback for a module/cmdline parameter
...@@ -192,7 +192,7 @@ struct kparam_array ...@@ -192,7 +192,7 @@ struct kparam_array
{ (void *)set, (void *)get }; \ { (void *)set, (void *)get }; \
__module_param_call(MODULE_PARAM_PREFIX, \ __module_param_call(MODULE_PARAM_PREFIX, \
name, &__param_ops_##name, arg, \ name, &__param_ops_##name, arg, \
(perm) + sizeof(__check_old_set_param(set))*0, 0) (perm) + sizeof(__check_old_set_param(set))*0, -1)
/* We don't get oldget: it's often a new-style param_get_uint, etc. */ /* We don't get oldget: it's often a new-style param_get_uint, etc. */
static inline int static inline int
...@@ -272,7 +272,7 @@ static inline void __kernel_param_unlock(void) ...@@ -272,7 +272,7 @@ static inline void __kernel_param_unlock(void)
*/ */
#define core_param(name, var, type, perm) \ #define core_param(name, var, type, perm) \
param_check_##type(name, &(var)); \ param_check_##type(name, &(var)); \
__module_param_call("", name, &param_ops_##type, &var, perm, 0) __module_param_call("", name, &param_ops_##type, &var, perm, -1)
#endif /* !MODULE */ #endif /* !MODULE */
/** /**
...@@ -290,7 +290,7 @@ static inline void __kernel_param_unlock(void) ...@@ -290,7 +290,7 @@ static inline void __kernel_param_unlock(void)
= { len, string }; \ = { len, string }; \
__module_param_call(MODULE_PARAM_PREFIX, name, \ __module_param_call(MODULE_PARAM_PREFIX, name, \
&param_ops_string, \ &param_ops_string, \
.str = &__param_string_##name, perm, 0); \ .str = &__param_string_##name, perm, -1); \
__MODULE_PARM_TYPE(name, "string") __MODULE_PARM_TYPE(name, "string")
/** /**
...@@ -432,7 +432,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp); ...@@ -432,7 +432,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
__module_param_call(MODULE_PARAM_PREFIX, name, \ __module_param_call(MODULE_PARAM_PREFIX, name, \
&param_array_ops, \ &param_array_ops, \
.arr = &__param_arr_##name, \ .arr = &__param_arr_##name, \
perm, 0); \ perm, -1); \
__MODULE_PARM_TYPE(name, "array of " #type) __MODULE_PARM_TYPE(name, "array of " #type)
extern struct kernel_param_ops param_array_ops; extern struct kernel_param_ops param_array_ops;
......
...@@ -508,7 +508,7 @@ asmlinkage void __init start_kernel(void) ...@@ -508,7 +508,7 @@ asmlinkage void __init start_kernel(void)
parse_early_param(); parse_early_param();
parse_args("Booting kernel", static_command_line, __start___param, parse_args("Booting kernel", static_command_line, __start___param,
__stop___param - __start___param, __stop___param - __start___param,
0, 0, &unknown_bootoption); -1, -1, &unknown_bootoption);
jump_label_init(); jump_label_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment