From 7e5f460ec457fe310156e399198a41eb0ce1e98c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Jul 2021 09:03:29 -0600 Subject: 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 --- cmd/nand.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cmd/nand.c') diff --git a/cmd/nand.c b/cmd/nand.c index 97e117a979..34371b983a 100644 --- a/cmd/nand.c +++ b/cmd/nand.c @@ -543,7 +543,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 3) goto usage; - off = (int)simple_strtoul(argv[2], NULL, 16); + off = (int)hextoul(argv[2], NULL); ret = nand_dump(mtd, off, !strcmp(&cmd[4], ".oob"), repeat); return ret == 0 ? 1 : 0; @@ -559,7 +559,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 4) goto usage; - addr = (ulong)simple_strtoul(argv[2], NULL, 16); + addr = (ulong)hextoul(argv[2], NULL); read = strncmp(cmd, "read", 4) == 0; /* 1 = read, 0 = write */ printf("\nNAND %s: ", read ? "read" : "write"); @@ -713,7 +713,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc, goto usage; while (argc > 0) { - addr = simple_strtoul(*argv, NULL, 16); + addr = hextoul(*argv, NULL); if (mtd_block_markbad(mtd, addr)) { printf("block 0x%08lx NOT marked " @@ -957,7 +957,7 @@ static int do_nandboot(struct cmd_tbl *cmdtp, int flag, int argc, if (argc > 3) goto usage; if (argc == 3) - addr = simple_strtoul(argv[1], NULL, 16); + addr = hextoul(argv[1], NULL); else addr = CONFIG_SYS_LOAD_ADDR; @@ -975,17 +975,17 @@ static int do_nandboot(struct cmd_tbl *cmdtp, int flag, int argc, boot_device = env_get("bootdevice"); break; case 2: - addr = simple_strtoul(argv[1], NULL, 16); + addr = hextoul(argv[1], NULL); boot_device = env_get("bootdevice"); break; case 3: - addr = simple_strtoul(argv[1], NULL, 16); + addr = hextoul(argv[1], NULL); boot_device = argv[2]; break; case 4: - addr = simple_strtoul(argv[1], NULL, 16); + addr = hextoul(argv[1], NULL); boot_device = argv[2]; - offset = simple_strtoul(argv[3], NULL, 16); + offset = hextoul(argv[3], NULL); break; default: #if defined(CONFIG_CMD_MTDPARTS) @@ -1003,7 +1003,7 @@ usage: } bootstage_mark(BOOTSTAGE_ID_NAND_BOOT_DEVICE); - idx = simple_strtoul(boot_device, NULL, 16); + idx = hextoul(boot_device, NULL); mtd = get_nand_dev_by_index(idx); if (!mtd) { -- cgit v1.2.3