aboutsummaryrefslogtreecommitdiff
path: root/board/gdsys
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-24 09:03:29 -0600
committerTom Rini <trini@konsulko.com>2021-08-02 13:32:14 -0400
commit7e5f460ec457fe310156e399198a41eb0ce1e98c (patch)
tree7e89e4d15fcea2d2263c4b4af1be69905537ef42 /board/gdsys
parent031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff)
downloadu-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.zip
u-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.gz
u-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.bz2
global: Convert simple_strtoul() with hex to hextoul()
It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board/gdsys')
-rw-r--r--board/gdsys/common/osd.c18
-rw-r--r--board/gdsys/common/osd_cmd.c16
2 files changed, 17 insertions, 17 deletions
diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c
index 679f8f3..dc548ef 100644
--- a/board/gdsys/common/osd.c
+++ b/board/gdsys/common/osd.c
@@ -284,9 +284,9 @@ static int osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
if (!(osd_screen_mask & (1 << screen)))
continue;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
- color = simple_strtoul(argv[3], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
+ color = hextoul(argv[3], NULL);
text = argv[4];
charcount = strlen(text);
len = (charcount > bufsize) ? bufsize : charcount;
@@ -416,13 +416,13 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
char *rp;
u16 *wp = buffer;
unsigned count = (argc > 4) ?
- simple_strtoul(argv[4], NULL, 16) : 1;
+ hextoul(argv[4], NULL) : 1;
if (!(osd_screen_mask & (1 << screen)))
continue;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
rp = argv[3];
@@ -431,7 +431,7 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
memcpy(substr, rp, 4);
substr[4] = 0;
- *wp = simple_strtoul(substr, NULL, 16);
+ *wp = hextoul(substr, NULL);
rp += 4;
wp++;
@@ -463,8 +463,8 @@ int osd_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
if (!x || (x > 64) || (x > MAX_X_CHARS) ||
!y || (y > 32) || (y > MAX_Y_CHARS)) {
diff --git a/board/gdsys/common/osd_cmd.c b/board/gdsys/common/osd_cmd.c
index fe62497..6a9c0b4 100644
--- a/board/gdsys/common/osd_cmd.c
+++ b/board/gdsys/common/osd_cmd.c
@@ -30,10 +30,10 @@ static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4 || (strlen(argv[3])) % 2)
return CMD_RET_USAGE;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
hexstr = argv[3];
- count = (argc > 4) ? simple_strtoul(argv[4], NULL, 16) : 1;
+ count = (argc > 4) ? hextoul(argv[4], NULL) : 1;
buflen = strlen(hexstr) / 2;
@@ -80,9 +80,9 @@ static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 5)
return CMD_RET_USAGE;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
- color = simple_strtoul(argv[3], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
+ color = hextoul(argv[3], NULL);
text = argv[4];
for (uclass_first_device(UCLASS_VIDEO_OSD, &dev);
@@ -109,8 +109,8 @@ static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
for (uclass_first_device(UCLASS_VIDEO_OSD, &dev);
dev;