mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + lib-kstrtoxc-add-false-true-support-to-kstrtobool.patch added to -mm tree
@ 2022-04-26 19:11 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-04-26 19:11 UTC (permalink / raw)
  To: mm-commits, ying.huang, willy, rf, pmladek, Jonathan.Cameron,
	dave.hansen, andriy.shevchenko, adobriyan, jvgediya, akpm


The patch titled
     Subject: lib/kstrtox.c: add "false"/"true" support to kstrtobool()
has been added to the -mm tree.  Its filename is
     lib-kstrtoxc-add-false-true-support-to-kstrtobool.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/lib-kstrtoxc-add-false-true-support-to-kstrtobool.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/lib-kstrtoxc-add-false-true-support-to-kstrtobool.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Jagdish Gediya <jvgediya@linux.ibm.com>
Subject: lib/kstrtox.c: add "false"/"true" support to kstrtobool()

At many places in kernel, It is necessary to convert sysfs input to
corrosponding bool value e.g.  "false" or "0" need to be converted to bool
false, "true" or "1" need to be converted to bool true, places where such
conversion is needed currently check the input string manually,
kstrtobool() can be utilized at such places but currently it doesn't have
support to accept "false"/"true".

Add support to accept "false"/"true" as valid string in kstrtobool().

Link: https://lkml.kernel.org/r/20220426180203.70782-1-jvgediya@linux.ibm.com
Signed-off-by: Jagdish Gediya <jvgediya@linux.ibm.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Richard Fitzgerald <rf@opensource.cirrus.com>
Cc: Petr Mladek <pmladek@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/kstrtox.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/lib/kstrtox.c~lib-kstrtoxc-add-false-true-support-to-kstrtobool
+++ a/lib/kstrtox.c
@@ -340,7 +340,7 @@ EXPORT_SYMBOL(kstrtos8);
  * @s: input string
  * @res: result
  *
- * This routine returns 0 iff the first character is one of 'Yy1Nn0', or
+ * This routine returns 0 if the first character is one of 'YyTt1NnFf0', or
  * [oO][NnFf] for "on" and "off". Otherwise it will return -EINVAL.  Value
  * pointed to by res is updated upon finding a match.
  */
@@ -353,11 +353,15 @@ int kstrtobool(const char *s, bool *res)
 	switch (s[0]) {
 	case 'y':
 	case 'Y':
+	case 't':
+	case 'T':
 	case '1':
 		*res = true;
 		return 0;
 	case 'n':
 	case 'N':
+	case 'f':
+	case 'F':
 	case '0':
 		*res = false;
 		return 0;
_

Patches currently in -mm which might be from jvgediya@linux.ibm.com are

lib-kstrtoxc-add-false-true-support-to-kstrtobool.patch
mm-convert-sysfs-input-to-bool-using-kstrtobool.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-26 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 19:11 + lib-kstrtoxc-add-false-true-support-to-kstrtobool.patch added to -mm tree Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).