Skip to contentSkip to conversation

module_param: invbool should take a 'bool', not an 'int'

PATCH In review Rusty Russell 1 participant 1 message Mar 28, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 module_param: invbool should take a 'bool', not an 'int'

Impact: cleanup, minor API change

It takes an 'int' for historical reasons, and there are only two
users: simply switch it over to bool.

The other user (uvesafb.c) will get a (harmless-on-x86) warning until the next patch is applied.

Cc Brad Douglas <[email protected]>
Cc Michal Januszewski <[email protected]>
---
 drivers/video/aty/aty128fb.c |    2 +-
 include/linux/moduleparam.h  |    2 +-
 kernel/params.c              |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/video/aty/aty128fb.c +1 -1
@@ -354,7 +355,7 @@ static int default_lcd_on __devinitdata 
 static int default_lcd_on __devinitdata = 1;
 
 #ifdef CONFIG_MTRR
-static int mtrr = 1;
+static bool mtrr = true;
 #endif
 
 #ifdef CONFIG_PMAC_BACKLIGHT
include/linux/moduleparam.h +1 -1
@@ -187,7 +187,7 @@ extern int param_get_bool(char *buffer, 
 
 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)
+#define param_check_invbool(name, p) __param_check(name, p, bool)
 
 /* Comma-separated array: *nump is set to number they actually specified. */
 #define module_param_array_named(name, array, type, nump, perm)		\
kernel/params.c +2 -2
@@ -257,13 +257,13 @@ int param_set_invbool(const char *val, s
 	dummy.arg = &boolval;
 	ret = param_set_bool(val, &dummy);
 	if (ret == 0)
-		*(int *)kp->arg = !boolval;
+		*(bool *)kp->arg = !boolval;
 	return ret;
 }
 
 int param_get_invbool(char *buffer, struct kernel_param *kp)
 {
-	return sprintf(buffer, "%c", (*(int *)kp->arg) ? 'N' : 'Y');
+	return sprintf(buffer, "%c", (*(bool *)kp->arg) ? 'N' : 'Y');
 }
 
 /* We break the rule and mangle the string. */