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>
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 @@
++arg;
}
- len_arg = simple_strtoul(arg, &ep, 16);
+ len_arg = hextoul(arg, &ep);
if (ep == arg || *ep != '\0')
return -1;
@@ -119,7 +119,7 @@
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 @@
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 @@
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;