params.c: Use new strtobool function to process boolean inputs
authorJonathan Cameron <jic23@cam.ac.uk>
Tue, 19 Apr 2011 11:43:47 +0000 (12:43 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 25 Apr 2011 23:04:52 +0000 (16:04 -0700)
No functional changes.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/params.c

index 7ab388a48a2eb2eb60551cc8a56dc748a429dae0..6888761f1b4e13e15c181bd7e311210f380ce84f 100644 (file)
@@ -297,21 +297,15 @@ EXPORT_SYMBOL(param_ops_charp);
 int param_set_bool(const char *val, const struct kernel_param *kp)
 {
        bool v;
+       int ret;
 
        /* No equals means "set"... */
        if (!val) val = "1";
 
        /* One of =[yYnN01] */
-       switch (val[0]) {
-       case 'y': case 'Y': case '1':
-               v = true;
-               break;
-       case 'n': case 'N': case '0':
-               v = false;
-               break;
-       default:
-               return -EINVAL;
-       }
+       ret = strtobool(val, &v);
+       if (ret)
+               return ret;
 
        if (kp->flags & KPARAM_ISBOOL)
                *(bool *)kp->arg = v;