summaryrefslogtreecommitdiff
path: root/cmd/rtc.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/rtc.c
parent031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff)
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/rtc.c')
-rw-r--r--cmd/rtc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/rtc.c b/cmd/rtc.c
index b4f61b2e83..784879ec1a 100644
--- a/cmd/rtc.c
+++ b/cmd/rtc.c
@@ -18,13 +18,13 @@ static int do_rtc_read(struct udevice *dev, int argc, char * const argv[])
if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[0], NULL, 16);
- len = simple_strtoul(argv[1], NULL, 16);
+ reg = hextoul(argv[0], NULL);
+ len = hextoul(argv[1], NULL);
if (argc == 3) {
u8 *addr;
- addr = map_sysmem(simple_strtoul(argv[2], NULL, 16), len);
+ addr = map_sysmem(hextoul(argv[2], NULL), len);
ret = dm_rtc_read(dev, reg, addr, len);
unmap_sysmem(addr);
if (ret) {
@@ -59,13 +59,13 @@ static int do_rtc_write(struct udevice *dev, int argc, char * const argv[])
if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[0], NULL, 16);
+ reg = hextoul(argv[0], NULL);
if (argc == 3) {
u8 *addr;
- len = simple_strtoul(argv[1], NULL, 16);
- addr = map_sysmem(simple_strtoul(argv[2], NULL, 16), len);
+ len = hextoul(argv[1], NULL);
+ addr = map_sysmem(hextoul(argv[2], NULL), len);
ret = dm_rtc_write(dev, reg, addr, len);
unmap_sysmem(addr);
if (ret) {