+ auxdisplay-charlcd-deduplicate-simple_strtoul.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: auxdisplay: charlcd: deduplicate simple_strtoul()
has been added to the -mm tree.  Its filename is
     auxdisplay-charlcd-deduplicate-simple_strtoul.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/auxdisplay-charlcd-deduplicate-simple_strtoul.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/auxdisplay-charlcd-deduplicate-simple_strtoul.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: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Subject: auxdisplay: charlcd: deduplicate simple_strtoul()

Like in the commit
  8b2303de399f ("serial: core: Fix handling of options after MMIO address")
we may use simple_strtoul() which in comparison to kstrtoul() can do conversion
in-place without additional and unnecessary code to be written.

Link: http://lkml.kernel.org/r/20190801192904.41087-2-andriy.shevchenko@xxxxxxxxxxxxxxx
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
Cc: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Cc: Mans Rullgard <mans@xxxxxxxxx>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/auxdisplay/charlcd.c |   34 ++++++---------------------------
 1 file changed, 7 insertions(+), 27 deletions(-)

--- a/drivers/auxdisplay/charlcd.c~auxdisplay-charlcd-deduplicate-simple_strtoul
+++ a/drivers/auxdisplay/charlcd.c
@@ -288,31 +288,6 @@ static int charlcd_init_display(struct c
 }
 
 /*
- * Parses an unsigned integer from a string, until a non-digit character
- * is found. The empty string is not accepted. No overflow checks are done.
- *
- * Returns whether the parsing was successful. Only in that case
- * the output parameters are written to.
- *
- * TODO: If the kernel adds an inplace version of kstrtoul(), this function
- * could be easily replaced by that.
- */
-static bool parse_n(const char *s, unsigned long *res, const char **next_s)
-{
-	if (!isdigit(*s))
-		return false;
-
-	*res = 0;
-	while (isdigit(*s)) {
-		*res = *res * 10 + (*s - '0');
-		++s;
-	}
-
-	*next_s = s;
-	return true;
-}
-
-/*
  * Parses a movement command of the form "(.*);", where the group can be
  * any number of subcommands of the form "(x|y)[0-9]+".
  *
@@ -336,6 +311,7 @@ static bool parse_xy(const char *s, unsi
 {
 	unsigned long new_x = *x;
 	unsigned long new_y = *y;
+	char *p;
 
 	for (;;) {
 		if (!*s)
@@ -345,11 +321,15 @@ static bool parse_xy(const char *s, unsi
 			break;
 
 		if (*s == 'x') {
-			if (!parse_n(s + 1, &new_x, &s))
+			new_x = simple_strtoul(s + 1, &p, 10);
+			if (p == s + 1)
 				return false;
+			s = p;
 		} else if (*s == 'y') {
-			if (!parse_n(s + 1, &new_y, &s))
+			new_y = simple_strtoul(s + 1, &p, 10);
+			if (p == s + 1)
 				return false;
+			s = p;
 		} else {
 			return false;
 		}
_

Patches currently in -mm which might be from andriy.shevchenko@xxxxxxxxxxxxxxx are

lib-test_bitmap-force-argument-of-bitmap_parselist_user-to-proper-address-space.patch
lib-test_bitmap-undefine-macros-after-use.patch
lib-test_bitmap-name-exp_bytes-properly.patch
lib-test_bitmap-rename-exp-to-exp1-to-avoid-ambiguous-name.patch
lib-test_bitmap-move-exp1-and-exp2-upper-for-others-to-use.patch
lib-test_bitmap-fix-comment-about-this-file.patch
bitmap-introduce-bitmap_replace-helper.patch
gpio-pca953x-remove-redundant-variable-and-check-in-irq-handler.patch
gpio-pca953x-use-input-from-regs-structure-in-pca953x_irq_pending.patch
gpio-pca953x-convert-to-use-bitmap-api.patch
gpio-pca953x-convert-to-use-bitmap-api-fix.patch
gpio-pca953x-tight-up-indentation.patch
kernelh-update-comment-about-simple_strtofoo-functions.patch
auxdisplay-charlcd-deduplicate-simple_strtoul.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux