diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2004-10-19 18:10:43 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-19 18:10:43 -0700 |
| commit | 9229204bae3b2928b68351bc3a2c26769ea74047 (patch) | |
| tree | d680f21ea2fce07de9e672511fde3bbeb51447e0 /include | |
| parent | 1c854f6f64e327b63d3e0814e705ac2c4f5d9052 (diff) | |
[PATCH] module_param_array() should take a pointer
module_param_array() takes a variable to put the number of elements in.
Looking through the uses, many people don't care, so they declare a dummy
or share one variable between several parameters. The latter is
problematic because sysfs uses that number to decide how many to display.
The solution is to change the variable arg to a pointer, and if the pointer
is NULL, use the "max" value. This change is fairly small, but fixing up
the callers is a lot of (trivial) churn.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/i2c.h | 2 | ||||
| -rw-r--r-- | include/linux/moduleparam.h | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index caac24868d85..bd2735bdca6b 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -568,7 +568,7 @@ union i2c_smbus_data { static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ static unsigned int var##_num; \ /*MODULE_PARM(var,I2C_CLIENT_MODPARM);*/ \ - module_param_array(var, short, var##_num, 0); \ + module_param_array(var, short, &var##_num, 0); \ MODULE_PARM_DESC(var,desc) /* This is the one you want to use in your own modules */ diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 7a145cd86c40..4e6e7a51d74f 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -129,16 +129,16 @@ extern int param_set_invbool(const char *val, struct kernel_param *kp); extern int param_get_invbool(char *buffer, struct kernel_param *kp); #define param_check_invbool(name, p) __param_check(name, p, int) -/* Comma-separated array: num is set to number they actually specified. */ -#define module_param_array_named(name, array, type, num, perm) \ +/* Comma-separated array: *nump is set to number they actually specified. */ +#define module_param_array_named(name, array, type, nump, perm) \ static struct kparam_array __param_arr_##name \ - = { ARRAY_SIZE(array), &num, param_set_##type, param_get_##type,\ + = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ sizeof(array[0]), array }; \ module_param_call(name, param_array_set, param_array_get, \ &__param_arr_##name, perm) -#define module_param_array(name, type, num, perm) \ - module_param_array_named(name, name, type, num, perm) +#define module_param_array(name, type, nump, perm) \ + module_param_array_named(name, name, type, nump, perm) extern int param_array_set(const char *val, struct kernel_param *kp); extern int param_array_get(char *buffer, struct kernel_param *kp); |
