Skip to contentSkip to conversation

mm: use existing helper to convert "on"/"off" to boolean

PATCH New [email protected] 1 participant 1 message May 20, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 37/162 mm: use existing helper to convert "on"/"off" to boolean

From: Minfei Huang <[email protected]>
Subject: mm: use existing helper to convert "on"/"off" to boolean

It's more convenient to use existing function helper to convert string "on/off" to boolean.

---

 mm/page_alloc.c  |    9 +--------
 mm/page_poison.c |    8 +-------
 2 files changed, 2 insertions(+), 15 deletions(-)
mm/page_alloc.c renamed from mm/page_alloc.c~use-existing-helper-to-convert-on-off-to-boolean +1 -8
diff -puN mm/page_alloc.c~use-existing-helper-to-convert-on-off-to-boolean mm/page_alloc.c
@@ -613,14 +613,7 @@ static int __init early_debug_pagealloc(
 {
 	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);
 
mm/page_poison.c renamed from mm/page_poison.c~use-existing-helper-to-convert-on-off-to-boolean +0 -5
diff -puN mm/page_poison.c~use-existing-helper-to-convert-on-off-to-boolean mm/page_poison.c
@@ -13,13 +13,7 @@ static int early_page_poison_param(char
 {
 	if (!buf)
 		return -EINVAL;
-
-	if (strcmp(buf, "on") == 0)
-		want_page_poisoning = true;
-	else if (strcmp(buf, "off") == 0)
-		want_page_poisoning = false;