]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
staging: panel: change own pieces of code by strtoul()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Thu, 22 Jul 2010 16:57:08 +0000 (19:57 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Jul 2010 18:34:52 +0000 (11:34 -0700)
We have nice method simple_strtoul() to convert string to numbers which
could be used here.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/panel/panel.c

index 8bd7182195b399c82300d5f8e52afe8e42088fc4..3e07e41eb88564f0ba6b531f3fc20692d794b06f 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/parport.h>
 #include <linux/version.h>
@@ -1179,22 +1180,16 @@ static inline int handle_lcd_special_code(void)
                        break;
 
                while (*esc) {
+                       char *endp;
+
                        if (*esc == 'x') {
                                esc++;
-                               lcd_addr_x = 0;
-                               while (isdigit(*esc)) {
-                                       lcd_addr_x = lcd_addr_x * 10 +
-                                                    (*esc - '0');
-                                       esc++;
-                               }
+                               lcd_addr_x = simple_strtoul(esc, &endp, 10);
+                               esc = endp;
                        } else if (*esc == 'y') {
                                esc++;
-                               lcd_addr_y = 0;
-                               while (isdigit(*esc)) {
-                                       lcd_addr_y = lcd_addr_y * 10 +
-                                                    (*esc - '0');
-                                       esc++;
-                               }
+                               lcd_addr_y = simple_strtoul(esc, &endp, 10);
+                               esc = endp;
                        } else
                                break;
                }