s390/vdso: reuse kstrtobool for option value parsing
authorVasily Gorbik <gor@linux.ibm.com>
Mon, 19 Aug 2019 15:41:17 +0000 (17:41 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 26 Aug 2019 10:51:17 +0000 (12:51 +0200)
"vdso" option setup already recognises integer and textual values. Yet
kstrtobool is a more common way to parse boolean values, reuse it to
unify option value parsing behavior and simplify code a bit.

While at it, __setup value parsing callbacks are expected to return
1 when an option is recognized, and returning any other value won't
trigger any error message currently, so simply return 1.

Also don't change default vdso_enabled value of 1 when "vdso" option
value is invalid.

Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/kernel/vdso.c

index 243d8b1..1d98a9f 100644 (file)
@@ -97,21 +97,13 @@ static const struct vm_special_mapping vdso_mapping = {
        .mremap = vdso_mremap,
 };
 
-static int __init vdso_setup(char *s)
+static int __init vdso_setup(char *str)
 {
-       unsigned long val;
-       int rc;
+       bool enabled;
 
-       rc = 0;
-       if (strncmp(s, "on", 3) == 0)
-               vdso_enabled = 1;
-       else if (strncmp(s, "off", 4) == 0)
-               vdso_enabled = 0;
-       else {
-               rc = kstrtoul(s, 0, &val);
-               vdso_enabled = rc ? 0 : !!val;
-       }
-       return !rc;
+       if (!kstrtobool(str, &enabled))
+               vdso_enabled = enabled;
+       return 1;
 }
 __setup("vdso=", vdso_setup);