diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 09:03:29 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 13:32:14 -0400 |
commit | 7e5f460ec457fe310156e399198a41eb0ce1e98c (patch) | |
tree | 7e89e4d15fcea2d2263c4b4af1be69905537ef42 /cmd/fpga.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/fpga.c')
-rw-r--r-- | cmd/fpga.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/fpga.c b/cmd/fpga.c index 51410a8e424..3fdd0b35e80 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -57,7 +57,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size, } *fpga_data = local_fpga_data; - local_data_size = simple_strtoul(argv[2], NULL, 16); + local_data_size = hextoul(argv[2], NULL); if (!local_data_size) { debug("fpga: zero size\n"); return CMD_RET_USAGE; @@ -95,8 +95,8 @@ int do_fpga_loads(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) */ argc++; - fpga_sec_info.encflag = (u8)simple_strtoul(argv[4], NULL, 16); - fpga_sec_info.authflag = (u8)simple_strtoul(argv[3], NULL, 16); + fpga_sec_info.encflag = (u8)hextoul(argv[4], NULL); + fpga_sec_info.authflag = (u8)hextoul(argv[3], NULL); if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH && fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) { @@ -134,7 +134,7 @@ static int do_fpga_loadfs(struct cmd_tbl *cmdtp, int flag, int argc, return ret; fpga_fsinfo.fstype = FS_TYPE_ANY; - fpga_fsinfo.blocksize = (unsigned int)simple_strtoul(argv[3], NULL, 16); + fpga_fsinfo.blocksize = (unsigned int)hextoul(argv[3], NULL); fpga_fsinfo.interface = argv[4]; fpga_fsinfo.dev_part = argv[5]; fpga_fsinfo.filename = argv[6]; @@ -274,7 +274,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc, } else #endif { - fpga_data = (void *)simple_strtoul(datastr, NULL, 16); + fpga_data = (void *)hextoul(datastr, NULL); debug("* fpga: cmdline image address = 0x%08lx\n", (ulong)fpga_data); } |