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>
This commit is contained in:
Simon Glass 2021-07-24 09:03:29 -06:00 committed by Tom Rini
parent 031725f8cd
commit 7e5f460ec4
183 changed files with 692 additions and 659 deletions

View file

@ -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);
}