diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-08 01:28:13 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-08 01:28:13 -0400 |
commit | ae82fdb1406ad41d68f07027fe31f2d35ba22a90 (patch) | |
tree | dced5ed8a4afeeab7e3c3610d0272f2f18106f33 | |
parent | f8f5701bdaf9134b1f90e5044a82c66324d2073f (diff) |
module_param: stop double-calling parameters.
Commit 026cee0086fe1df4cf74691cf273062cc769617d "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: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
-rw-r--r-- | include/linux/moduleparam.h | 10 | ||||
-rw-r--r-- | init/main.c | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 1b14d25162cb..d6a58065c09c 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -128,7 +128,7 @@ struct kparam_array | |||
128 | * The ops can have NULL set or get functions. | 128 | * The ops can have NULL set or get functions. |
129 | */ | 129 | */ |
130 | #define module_param_cb(name, ops, arg, perm) \ | 130 | #define module_param_cb(name, ops, arg, perm) \ |
131 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0) | 131 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1) |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * <level>_param_cb - general callback for a module/cmdline parameter | 134 | * <level>_param_cb - general callback for a module/cmdline parameter |
@@ -192,7 +192,7 @@ struct kparam_array | |||
192 | { (void *)set, (void *)get }; \ | 192 | { (void *)set, (void *)get }; \ |
193 | __module_param_call(MODULE_PARAM_PREFIX, \ | 193 | __module_param_call(MODULE_PARAM_PREFIX, \ |
194 | name, &__param_ops_##name, arg, \ | 194 | name, &__param_ops_##name, arg, \ |
195 | (perm) + sizeof(__check_old_set_param(set))*0, 0) | 195 | (perm) + sizeof(__check_old_set_param(set))*0, -1) |
196 | 196 | ||
197 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ | 197 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ |
198 | static inline int | 198 | static inline int |
@@ -272,7 +272,7 @@ static inline void __kernel_param_unlock(void) | |||
272 | */ | 272 | */ |
273 | #define core_param(name, var, type, perm) \ | 273 | #define core_param(name, var, type, perm) \ |
274 | param_check_##type(name, &(var)); \ | 274 | param_check_##type(name, &(var)); \ |
275 | __module_param_call("", name, ¶m_ops_##type, &var, perm, 0) | 275 | __module_param_call("", name, ¶m_ops_##type, &var, perm, -1) |
276 | #endif /* !MODULE */ | 276 | #endif /* !MODULE */ |
277 | 277 | ||
278 | /** | 278 | /** |
@@ -290,7 +290,7 @@ static inline void __kernel_param_unlock(void) | |||
290 | = { len, string }; \ | 290 | = { len, string }; \ |
291 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 291 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
292 | ¶m_ops_string, \ | 292 | ¶m_ops_string, \ |
293 | .str = &__param_string_##name, perm, 0); \ | 293 | .str = &__param_string_##name, perm, -1); \ |
294 | __MODULE_PARM_TYPE(name, "string") | 294 | __MODULE_PARM_TYPE(name, "string") |
295 | 295 | ||
296 | /** | 296 | /** |
@@ -432,7 +432,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp); | |||
432 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 432 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
433 | ¶m_array_ops, \ | 433 | ¶m_array_ops, \ |
434 | .arr = &__param_arr_##name, \ | 434 | .arr = &__param_arr_##name, \ |
435 | perm, 0); \ | 435 | perm, -1); \ |
436 | __MODULE_PARM_TYPE(name, "array of " #type) | 436 | __MODULE_PARM_TYPE(name, "array of " #type) |
437 | 437 | ||
438 | extern struct kernel_param_ops param_array_ops; | 438 | extern struct kernel_param_ops param_array_ops; |
diff --git a/init/main.c b/init/main.c index 1ca6b32c4828..37e12098eac1 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -508,7 +508,7 @@ asmlinkage void __init start_kernel(void) | |||
508 | parse_early_param(); | 508 | parse_early_param(); |
509 | parse_args("Booting kernel", static_command_line, __start___param, | 509 | parse_args("Booting kernel", static_command_line, __start___param, |
510 | __stop___param - __start___param, | 510 | __stop___param - __start___param, |
511 | 0, 0, &unknown_bootoption); | 511 | -1, -1, &unknown_bootoption); |
512 | 512 | ||
513 | jump_label_init(); | 513 | jump_label_init(); |
514 | 514 | ||