diff options
author | Simon Glass | 2021-07-24 09:03:29 -0600 |
---|---|---|
committer | Tom Rini | 2021-08-02 13:32:14 -0400 |
commit | 7e5f460ec457fe310156e399198a41eb0ce1e98c (patch) | |
tree | 7e89e4d15fcea2d2263c4b4af1be69905537ef42 /cmd/mtd.c | |
parent | 031725f8cdf33e836d19f35d3fe82c5baa5a2976 (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/mtd.c')
-rw-r--r-- | cmd/mtd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/mtd.c b/cmd/mtd.c index c22478c1527..ad5cc9827d5 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -285,12 +285,12 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, goto out_put_mtd; } - user_addr = simple_strtoul(argv[0], NULL, 16); + user_addr = hextoul(argv[0], NULL); argc--; argv++; } - start_off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0; + start_off = argc > 0 ? hextoul(argv[0], NULL) : 0; if (!mtd_is_aligned_with_min_io_size(mtd, start_off)) { printf("Offset not aligned with a page (0x%x)\n", mtd->writesize); @@ -299,7 +299,7 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, } default_len = dump ? mtd->writesize : mtd->size; - len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : default_len; + len = argc > 1 ? hextoul(argv[1], NULL) : default_len; if (!mtd_is_aligned_with_min_io_size(mtd, len)) { len = round_up(len, mtd->writesize); printf("Size not on a page boundary (0x%x), rounding to 0x%llx\n", @@ -411,8 +411,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, argc -= 2; argv += 2; - off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0; - len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : mtd->size; + off = argc > 0 ? hextoul(argv[0], NULL) : 0; + len = argc > 1 ? hextoul(argv[1], NULL) : mtd->size; if (!mtd_is_aligned_with_block_size(mtd, off)) { printf("Offset not aligned with a block (0x%x)\n", |