aboutsummaryrefslogtreecommitdiff
path: root/cmd/sf.c
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 /cmd/sf.c
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 'cmd/sf.c')
-rw-r--r--cmd/sf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/sf.c b/cmd/sf.c
index 46346fb..eac27ed 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -54,7 +54,7 @@ static int sf_parse_len_arg(char *arg, ulong *len)
++arg;
}
- len_arg = simple_strtoul(arg, &ep, 16);
+ len_arg = hextoul(arg, &ep);
if (ep == arg || *ep != '\0')
return -1;
@@ -119,7 +119,7 @@ static int do_spi_flash_probe(int argc, char *const argv[])
return -1;
}
if (argc >= 4) {
- mode = simple_strtoul(argv[3], &endp, 16);
+ mode = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return -1;
}
@@ -272,7 +272,7 @@ static int do_spi_flash_read_write(int argc, char *const argv[])
if (argc < 3)
return -1;
- addr = simple_strtoul(argv[1], &endp, 16);
+ addr = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
@@ -517,10 +517,10 @@ static int do_spi_flash_test(int argc, char *const argv[])
if (argc < 3)
return -1;
- offset = simple_strtoul(argv[1], &endp, 16);
+ offset = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
- len = simple_strtoul(argv[2], &endp, 16);
+ len = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return -1;