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 /kernel/params.c | |
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 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/kernel/params.c b/kernel/params.c index 47f5bf12434a..508828afb874 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -297,35 +297,18 @@ EXPORT_SYMBOL(param_ops_charp); | |||
297 | /* Actually could be a bool or an int, for historical reasons. */ | 297 | /* Actually could be a bool or an int, for historical reasons. */ |
298 | int param_set_bool(const char *val, const struct kernel_param *kp) | 298 | int param_set_bool(const char *val, const struct kernel_param *kp) |
299 | { | 299 | { |
300 | bool v; | ||
301 | int ret; | ||
302 | |||
303 | /* No equals means "set"... */ | 300 | /* No equals means "set"... */ |
304 | if (!val) val = "1"; | 301 | if (!val) val = "1"; |
305 | 302 | ||
306 | /* One of =[yYnN01] */ | 303 | /* One of =[yYnN01] */ |
307 | ret = strtobool(val, &v); | 304 | return strtobool(val, kp->arg); |
308 | if (ret) | ||
309 | return ret; | ||
310 | |||
311 | if (kp->flags & KPARAM_ISBOOL) | ||
312 | *(bool *)kp->arg = v; | ||
313 | else | ||
314 | *(int *)kp->arg = v; | ||
315 | return 0; | ||
316 | } | 305 | } |
317 | EXPORT_SYMBOL(param_set_bool); | 306 | EXPORT_SYMBOL(param_set_bool); |
318 | 307 | ||
319 | int param_get_bool(char *buffer, const struct kernel_param *kp) | 308 | int param_get_bool(char *buffer, const struct kernel_param *kp) |
320 | { | 309 | { |
321 | bool val; | ||
322 | if (kp->flags & KPARAM_ISBOOL) | ||
323 | val = *(bool *)kp->arg; | ||
324 | else | ||
325 | val = *(int *)kp->arg; | ||
326 | |||
327 | /* Y and N chosen as being relatively non-coder friendly */ | 310 | /* Y and N chosen as being relatively non-coder friendly */ |
328 | return sprintf(buffer, "%c", val ? 'Y' : 'N'); | 311 | return sprintf(buffer, "%c", *(bool *)kp->arg ? 'Y' : 'N'); |
329 | } | 312 | } |
330 | EXPORT_SYMBOL(param_get_bool); | 313 | EXPORT_SYMBOL(param_get_bool); |
331 | 314 | ||
@@ -343,7 +326,6 @@ int param_set_invbool(const char *val, const struct kernel_param *kp) | |||
343 | struct kernel_param dummy; | 326 | struct kernel_param dummy; |
344 | 327 | ||
345 | dummy.arg = &boolval; | 328 | dummy.arg = &boolval; |
346 | dummy.flags = KPARAM_ISBOOL; | ||
347 | ret = param_set_bool(val, &dummy); | 329 | ret = param_set_bool(val, &dummy); |
348 | if (ret == 0) | 330 | if (ret == 0) |
349 | *(bool *)kp->arg = !boolval; | 331 | *(bool *)kp->arg = !boolval; |
@@ -372,7 +354,6 @@ int param_set_bint(const char *val, const struct kernel_param *kp) | |||
372 | /* Match bool exactly, by re-using it. */ | 354 | /* Match bool exactly, by re-using it. */ |
373 | boolkp = *kp; | 355 | boolkp = *kp; |
374 | boolkp.arg = &v; | 356 | boolkp.arg = &v; |
375 | boolkp.flags |= KPARAM_ISBOOL; | ||
376 | 357 | ||
377 | ret = param_set_bool(val, &boolkp); | 358 | ret = param_set_bool(val, &boolkp); |
378 | if (ret == 0) | 359 | if (ret == 0) |