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/mmc.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/mmc.c')
-rw-r--r-- | cmd/mmc.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/cmd/mmc.c b/cmd/mmc.c index b942576b58a..f72277800a0 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -189,7 +189,7 @@ static int do_mmcrpmb_key(struct cmd_tbl *cmdtp, int flag, if (argc != 2) return CMD_RET_USAGE; - key_addr = (void *)simple_strtoul(argv[1], NULL, 16); + key_addr = (void *)hextoul(argv[1], NULL); if (!confirm_key_prog()) return CMD_RET_FAILURE; if (mmc_rpmb_set_key(mmc, key_addr)) { @@ -211,12 +211,12 @@ static int do_mmcrpmb_read(struct cmd_tbl *cmdtp, int flag, if (argc < 4) return CMD_RET_USAGE; - addr = (void *)simple_strtoul(argv[1], NULL, 16); - blk = simple_strtoul(argv[2], NULL, 16); - cnt = simple_strtoul(argv[3], NULL, 16); + addr = (void *)hextoul(argv[1], NULL); + blk = hextoul(argv[2], NULL); + cnt = hextoul(argv[3], NULL); if (argc == 5) - key_addr = (void *)simple_strtoul(argv[4], NULL, 16); + key_addr = (void *)hextoul(argv[4], NULL); printf("\nMMC RPMB read: dev # %d, block # %d, count %d ... ", curr_device, blk, cnt); @@ -240,10 +240,10 @@ static int do_mmcrpmb_write(struct cmd_tbl *cmdtp, int flag, if (argc != 5) return CMD_RET_USAGE; - addr = (void *)simple_strtoul(argv[1], NULL, 16); - blk = simple_strtoul(argv[2], NULL, 16); - cnt = simple_strtoul(argv[3], NULL, 16); - key_addr = (void *)simple_strtoul(argv[4], NULL, 16); + addr = (void *)hextoul(argv[1], NULL); + blk = hextoul(argv[2], NULL); + cnt = hextoul(argv[3], NULL); + key_addr = (void *)hextoul(argv[4], NULL); printf("\nMMC RPMB write: dev # %d, block # %d, count %d ... ", curr_device, blk, cnt); @@ -334,9 +334,9 @@ static int do_mmc_read(struct cmd_tbl *cmdtp, int flag, if (argc != 4) return CMD_RET_USAGE; - addr = (void *)simple_strtoul(argv[1], NULL, 16); - blk = simple_strtoul(argv[2], NULL, 16); - cnt = simple_strtoul(argv[3], NULL, 16); + addr = (void *)hextoul(argv[1], NULL); + blk = hextoul(argv[2], NULL); + cnt = hextoul(argv[3], NULL); mmc = init_mmc_device(curr_device, false); if (!mmc) @@ -379,8 +379,8 @@ static int do_mmc_sparse_write(struct cmd_tbl *cmdtp, int flag, if (argc != 3) return CMD_RET_USAGE; - addr = (void *)simple_strtoul(argv[1], NULL, 16); - blk = simple_strtoul(argv[2], NULL, 16); + addr = (void *)hextoul(argv[1], NULL); + blk = hextoul(argv[2], NULL); if (!is_sparse_image(addr)) { printf("Not a sparse image\n"); @@ -427,9 +427,9 @@ static int do_mmc_write(struct cmd_tbl *cmdtp, int flag, if (argc != 4) return CMD_RET_USAGE; - addr = (void *)simple_strtoul(argv[1], NULL, 16); - blk = simple_strtoul(argv[2], NULL, 16); - cnt = simple_strtoul(argv[3], NULL, 16); + addr = (void *)hextoul(argv[1], NULL); + blk = hextoul(argv[2], NULL); + cnt = hextoul(argv[3], NULL); mmc = init_mmc_device(curr_device, false); if (!mmc) @@ -457,8 +457,8 @@ static int do_mmc_erase(struct cmd_tbl *cmdtp, int flag, if (argc != 3) return CMD_RET_USAGE; - blk = simple_strtoul(argv[1], NULL, 16); - cnt = simple_strtoul(argv[2], NULL, 16); + blk = hextoul(argv[1], NULL); + cnt = hextoul(argv[2], NULL); mmc = init_mmc_device(curr_device, false); if (!mmc) @@ -908,7 +908,7 @@ static int do_mmc_setdsr(struct cmd_tbl *cmdtp, int flag, if (argc != 2) return CMD_RET_USAGE; - val = simple_strtoul(argv[1], NULL, 16); + val = hextoul(argv[1], NULL); mmc = find_mmc_device(curr_device); if (!mmc) { |