summaryrefslogtreecommitdiffstats
path: root/lib/kstrtox.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kstrtox.c')
-rw-r--r--lib/kstrtox.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/kstrtox.c b/lib/kstrtox.c
index e8ba4a013e82..d8a5cf66c316 100644
--- a/lib/kstrtox.c
+++ b/lib/kstrtox.c
@@ -326,9 +326,9 @@ EXPORT_SYMBOL(kstrtos8);
326 * @s: input string 326 * @s: input string
327 * @res: result 327 * @res: result
328 * 328 *
329 * This routine returns 0 iff the first character is one of 'Yy1Nn0'. 329 * This routine returns 0 iff the first character is one of 'Yy1Nn0', or
330 * Otherwise it will return -EINVAL. Value pointed to by res is 330 * [oO][NnFf] for "on" and "off". Otherwise it will return -EINVAL. Value
331 * updated upon finding a match. 331 * pointed to by res is updated upon finding a match.
332 */ 332 */
333int kstrtobool(const char *s, bool *res) 333int kstrtobool(const char *s, bool *res)
334{ 334{
@@ -346,6 +346,20 @@ int kstrtobool(const char *s, bool *res)
346 case '0': 346 case '0':
347 *res = false; 347 *res = false;
348 return 0; 348 return 0;
349 case 'o':
350 case 'O':
351 switch (s[1]) {
352 case 'n':
353 case 'N':
354 *res = true;
355 return 0;
356 case 'f':
357 case 'F':
358 *res = false;
359 return 0;
360 default:
361 break;
362 }
349 default: 363 default:
350 break; 364 break;
351 } 365 }