From 7e5f460ec457fe310156e399198a41eb0ce1e98c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Jul 2021 09:03:29 -0600 Subject: 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 --- cmd/sf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/sf.c') 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; -- cgit v1.1