diff options
Diffstat (limited to 'include/linux/moduleparam.h')
-rw-r--r-- | include/linux/moduleparam.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 7939f636c8ba..c47f4d60db0b 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -350,23 +350,23 @@ extern int param_set_charp(const char *val, const struct kernel_param *kp); | |||
350 | extern int param_get_charp(char *buffer, const struct kernel_param *kp); | 350 | extern int param_get_charp(char *buffer, const struct kernel_param *kp); |
351 | #define param_check_charp(name, p) __param_check(name, p, char *) | 351 | #define param_check_charp(name, p) __param_check(name, p, char *) |
352 | 352 | ||
353 | /* For historical reasons "bool" parameters can be (unsigned) "int". */ | 353 | /* We used to allow int as well as bool. We're taking that away! */ |
354 | extern struct kernel_param_ops param_ops_bool; | 354 | extern struct kernel_param_ops param_ops_bool; |
355 | extern int param_set_bool(const char *val, const struct kernel_param *kp); | 355 | extern int param_set_bool(const char *val, const struct kernel_param *kp); |
356 | extern int param_get_bool(char *buffer, const struct kernel_param *kp); | 356 | extern int param_get_bool(char *buffer, const struct kernel_param *kp); |
357 | #define param_check_bool(name, p) \ | 357 | #define param_check_bool(name, p) __param_check(name, p, bool) |
358 | static inline void __check_##name(void) \ | ||
359 | { \ | ||
360 | BUILD_BUG_ON(!__same_type((p), bool *) && \ | ||
361 | !__same_type((p), unsigned int *) && \ | ||
362 | !__same_type((p), int *)); \ | ||
363 | } | ||
364 | 358 | ||
365 | extern struct kernel_param_ops param_ops_invbool; | 359 | extern struct kernel_param_ops param_ops_invbool; |
366 | extern int param_set_invbool(const char *val, const struct kernel_param *kp); | 360 | extern int param_set_invbool(const char *val, const struct kernel_param *kp); |
367 | extern int param_get_invbool(char *buffer, const struct kernel_param *kp); | 361 | extern int param_get_invbool(char *buffer, const struct kernel_param *kp); |
368 | #define param_check_invbool(name, p) __param_check(name, p, bool) | 362 | #define param_check_invbool(name, p) __param_check(name, p, bool) |
369 | 363 | ||
364 | /* An int, which can only be set like a bool (though it shows as an int). */ | ||
365 | extern struct kernel_param_ops param_ops_bint; | ||
366 | extern int param_set_bint(const char *val, const struct kernel_param *kp); | ||
367 | #define param_get_bint param_get_int | ||
368 | #define param_check_bint param_check_int | ||
369 | |||
370 | /** | 370 | /** |
371 | * module_param_array - a parameter which is an array of some type | 371 | * module_param_array - a parameter which is an array of some type |
372 | * @name: the name of the array variable | 372 | * @name: the name of the array variable |
@@ -395,6 +395,7 @@ extern int param_get_invbool(char *buffer, const struct kernel_param *kp); | |||
395 | * module_param_named() for why this might be necessary. | 395 | * module_param_named() for why this might be necessary. |
396 | */ | 396 | */ |
397 | #define module_param_array_named(name, array, type, nump, perm) \ | 397 | #define module_param_array_named(name, array, type, nump, perm) \ |
398 | param_check_##type(name, &(array)[0]); \ | ||
398 | static const struct kparam_array __param_arr_##name \ | 399 | static const struct kparam_array __param_arr_##name \ |
399 | = { .max = ARRAY_SIZE(array), .num = nump, \ | 400 | = { .max = ARRAY_SIZE(array), .num = nump, \ |
400 | .ops = ¶m_ops_##type, \ | 401 | .ops = ¶m_ops_##type, \ |