global: Convert simple_strtoul() with decimal to dectoul()
It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/board/cavium/thunderx/atf.c b/board/cavium/thunderx/atf.c
index 582af6f..1a039c5 100644
--- a/board/cavium/thunderx/atf.c
+++ b/board/cavium/thunderx/atf.c
@@ -236,47 +236,47 @@
if ((argc == 5) && !strcmp(argv[1], "readmmc")) {
buffer = (void *)hextoul(argv[2], NULL);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_read_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "readnor")) {
buffer = (void *)hextoul(argv[2], NULL);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_read_nor(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writemmc")) {
buffer = (void *)hextoul(argv[2], NULL);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_write_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writenor")) {
buffer = (void *)hextoul(argv[2], NULL);
- offset = simple_strtoul(argv[3], NULL, 10);
- size = simple_strtoul(argv[4], NULL, 10);
+ offset = dectoul(argv[3], NULL);
+ size = dectoul(argv[4], NULL);
ret = atf_write_nor(offset, buffer, size);
} else if ((argc == 2) && !strcmp(argv[1], "part")) {
atf_print_part_table();
} else if ((argc == 4) && !strcmp(argv[1], "erasenor")) {
- offset = simple_strtoul(argv[2], NULL, 10);
- size = simple_strtoul(argv[3], NULL, 10);
+ offset = dectoul(argv[2], NULL);
+ size = dectoul(argv[3], NULL);
ret = atf_erase_nor(offset, size);
} else if ((argc == 2) && !strcmp(argv[1], "envcount")) {
ret = atf_env_count();
printf("Number of environment strings: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "envstring")) {
- index = simple_strtoul(argv[2], NULL, 10);
+ index = dectoul(argv[2], NULL);
ret = atf_env_string(index, str);
if (ret > 0)
printf("Environment string %d: %s\n", index, str);
else
printf("Return code: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "dramsize")) {
- node = simple_strtoul(argv[2], NULL, 10);
+ node = dectoul(argv[2], NULL);
ret = atf_dram_size(node);
printf("DRAM size: %zd Mbytes\n", ret >> 20);
} else if ((argc == 2) && !strcmp(argv[1], "nodes")) {