mm: use existing helper to convert "on"/"off" to boolean
authorMinfei Huang <[email protected]>
Fri, 20 May 2016 23:58:13 +0000 (16:58 -0700)
committerLinus Torvalds <[email protected]>
Sat, 21 May 2016 00:58:30 +0000 (17:58 -0700)
It's more convenient to use existing function helper to convert string
"on/off" to boolean.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Minfei Huang <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c
mm/page_poison.c

index 7e49bc3705b6b67b9e6efcc3fe4980c3b7960665..3f4b69aaa23a8d5106aabbbd3780f3fb63cca3c0 100644 (file)
@@ -613,14 +613,7 @@ static int __init early_debug_pagealloc(char *buf)
 {
        if (!buf)
                return -EINVAL;
-
-       if (strcmp(buf, "on") == 0)
-               _debug_pagealloc_enabled = true;
-
-       if (strcmp(buf, "off") == 0)
-               _debug_pagealloc_enabled = false;
-
-       return 0;
+       return kstrtobool(buf, &_debug_pagealloc_enabled);
 }
 early_param("debug_pagealloc", early_debug_pagealloc);
 
index 479e7ea2bea6651d00f4b4d363b9bc9ab952591b..1eae5fad2446b4b7b069fde3d0e5b373418ea7bb 100644 (file)
@@ -13,13 +13,7 @@ static int early_page_poison_param(char *buf)
 {
        if (!buf)
                return -EINVAL;
-
-       if (strcmp(buf, "on") == 0)
-               want_page_poisoning = true;
-       else if (strcmp(buf, "off") == 0)
-               want_page_poisoning = false;
-
-       return 0;
+       return strtobool(buf, &want_page_poisoning);
 }
 early_param("page_poison", early_page_poison_param);