diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-03-25 22:20:51 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-03-25 22:20:51 -0400 |
commit | 8b8252813dee8e8cd453bb219731c36b268c69a7 (patch) | |
tree | 0e39d722a48b084d7fa84e2470cf1b33c71a0134 /include/linux | |
parent | 02608bef8f774c058779546926889a2f2717a499 (diff) |
module_param: remove support for bool parameters which are really int.
module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.
This eliminates that code (though leaves the flags field in the struct,
for impending use).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/moduleparam.h | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index c47f4d60db0b..4daa895648d9 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -47,9 +47,6 @@ struct kernel_param_ops { | |||
47 | void (*free)(void *arg); | 47 | void (*free)(void *arg); |
48 | }; | 48 | }; |
49 | 49 | ||
50 | /* Flag bits for kernel_param.flags */ | ||
51 | #define KPARAM_ISBOOL 2 | ||
52 | |||
53 | struct kernel_param { | 50 | struct kernel_param { |
54 | const char *name; | 51 | const char *name; |
55 | const struct kernel_param_ops *ops; | 52 | const struct kernel_param_ops *ops; |
@@ -131,8 +128,7 @@ struct kparam_array | |||
131 | * The ops can have NULL set or get functions. | 128 | * The ops can have NULL set or get functions. |
132 | */ | 129 | */ |
133 | #define module_param_cb(name, ops, arg, perm) \ | 130 | #define module_param_cb(name, ops, arg, perm) \ |
134 | __module_param_call(MODULE_PARAM_PREFIX, \ | 131 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm) |
135 | name, ops, arg, __same_type((arg), bool *), perm) | ||
136 | 132 | ||
137 | /* On alpha, ia64 and ppc64 relocations to global data cannot go into | 133 | /* On alpha, ia64 and ppc64 relocations to global data cannot go into |
138 | read-only sections (which is part of respective UNIX ABI on these | 134 | read-only sections (which is part of respective UNIX ABI on these |
@@ -146,7 +142,7 @@ struct kparam_array | |||
146 | 142 | ||
147 | /* This is the fundamental function for registering boot/module | 143 | /* This is the fundamental function for registering boot/module |
148 | parameters. */ | 144 | parameters. */ |
149 | #define __module_param_call(prefix, name, ops, arg, isbool, perm) \ | 145 | #define __module_param_call(prefix, name, ops, arg, perm) \ |
150 | /* Default value instead of permissions? */ \ | 146 | /* Default value instead of permissions? */ \ |
151 | static int __param_perm_check_##name __attribute__((unused)) = \ | 147 | static int __param_perm_check_##name __attribute__((unused)) = \ |
152 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ | 148 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ |
@@ -155,8 +151,7 @@ struct kparam_array | |||
155 | static struct kernel_param __moduleparam_const __param_##name \ | 151 | static struct kernel_param __moduleparam_const __param_##name \ |
156 | __used \ | 152 | __used \ |
157 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ | 153 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ |
158 | = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ | 154 | = { __param_str_##name, ops, perm, 0, { arg } } |
159 | { arg } } | ||
160 | 155 | ||
161 | /* Obsolete - use module_param_cb() */ | 156 | /* Obsolete - use module_param_cb() */ |
162 | #define module_param_call(name, set, get, arg, perm) \ | 157 | #define module_param_call(name, set, get, arg, perm) \ |
@@ -164,7 +159,6 @@ struct kparam_array | |||
164 | { (void *)set, (void *)get }; \ | 159 | { (void *)set, (void *)get }; \ |
165 | __module_param_call(MODULE_PARAM_PREFIX, \ | 160 | __module_param_call(MODULE_PARAM_PREFIX, \ |
166 | name, &__param_ops_##name, arg, \ | 161 | name, &__param_ops_##name, arg, \ |
167 | __same_type(arg, bool *), \ | ||
168 | (perm) + sizeof(__check_old_set_param(set))*0) | 162 | (perm) + sizeof(__check_old_set_param(set))*0) |
169 | 163 | ||
170 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ | 164 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ |
@@ -245,8 +239,7 @@ static inline void __kernel_param_unlock(void) | |||
245 | */ | 239 | */ |
246 | #define core_param(name, var, type, perm) \ | 240 | #define core_param(name, var, type, perm) \ |
247 | param_check_##type(name, &(var)); \ | 241 | param_check_##type(name, &(var)); \ |
248 | __module_param_call("", name, ¶m_ops_##type, \ | 242 | __module_param_call("", name, ¶m_ops_##type, &var, perm) |
249 | &var, __same_type(var, bool), perm) | ||
250 | #endif /* !MODULE */ | 243 | #endif /* !MODULE */ |
251 | 244 | ||
252 | /** | 245 | /** |
@@ -264,7 +257,7 @@ static inline void __kernel_param_unlock(void) | |||
264 | = { len, string }; \ | 257 | = { len, string }; \ |
265 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 258 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
266 | ¶m_ops_string, \ | 259 | ¶m_ops_string, \ |
267 | .str = &__param_string_##name, 0, perm); \ | 260 | .str = &__param_string_##name, perm); \ |
268 | __MODULE_PARM_TYPE(name, "string") | 261 | __MODULE_PARM_TYPE(name, "string") |
269 | 262 | ||
270 | /** | 263 | /** |
@@ -403,7 +396,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp); | |||
403 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 396 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
404 | ¶m_array_ops, \ | 397 | ¶m_array_ops, \ |
405 | .arr = &__param_arr_##name, \ | 398 | .arr = &__param_arr_##name, \ |
406 | __same_type(array[0], bool), perm); \ | 399 | perm); \ |
407 | __MODULE_PARM_TYPE(name, "array of " #type) | 400 | __MODULE_PARM_TYPE(name, "array of " #type) |
408 | 401 | ||
409 | extern struct kernel_param_ops param_array_ops; | 402 | extern struct kernel_param_ops param_array_ops; |