Skip to content

Commit d85170e

Browse files
andy-shevgregkh
authored andcommitted
staging: panel: change own pieces of code by strtoul()
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>
1 parent 47c7157 commit d85170e

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

‎drivers/staging/panel/panel.c‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include <linux/fcntl.h>
4949
#include <linux/init.h>
5050
#include <linux/delay.h>
51+
#include <linux/kernel.h>
5152
#include <linux/ctype.h>
5253
#include <linux/parport.h>
5354
#include <linux/version.h>
@@ -1179,22 +1180,16 @@ static inline int handle_lcd_special_code(void)
11791180
break;
11801181

11811182
while (*esc) {
1183+
char *endp;
1184+
11821185
if (*esc == 'x') {
11831186
esc++;
1184-
lcd_addr_x = 0;
1185-
while (isdigit(*esc)) {
1186-
lcd_addr_x = lcd_addr_x * 10 +
1187-
(*esc - '0');
1188-
esc++;
1189-
}
1187+
lcd_addr_x = simple_strtoul(esc, &endp, 10);
1188+
esc = endp;
11901189
} else if (*esc == 'y') {
11911190
esc++;
1192-
lcd_addr_y = 0;
1193-
while (isdigit(*esc)) {
1194-
lcd_addr_y = lcd_addr_y * 10 +
1195-
(*esc - '0');
1196-
esc++;
1197-
}
1191+
lcd_addr_y = simple_strtoul(esc, &endp, 10);
1192+
esc = endp;
11981193
} else
11991194
break;
12001195
}

0 commit comments

Comments
 (0)