diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 18:03:29 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 20:32:14 +0300 |
commit | 7e5f460ec457fe310156e399198a41eb0ce1e98c (patch) | |
tree | 7e89e4d15fcea2d2263c4b4af1be69905537ef42 /drivers/net | |
parent | 031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff) | |
download | u-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.xz |
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 'drivers/net')
-rw-r--r-- | drivers/net/e1000_spi.c | 4 | ||||
-rw-r--r-- | drivers/net/fm/fdt.c | 2 | ||||
-rw-r--r-- | drivers/net/fsl-mc/mc.c | 3 | ||||
-rw-r--r-- | drivers/net/pfe_eth/pfe_cmd.c | 14 | ||||
-rw-r--r-- | drivers/net/phy/b53.c | 10 | ||||
-rw-r--r-- | drivers/net/phy/mv88e6352.c | 2 |
6 files changed, 17 insertions, 18 deletions
diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c index 4fcc65d978..69adf282c7 100644 --- a/drivers/net/e1000_spi.c +++ b/drivers/net/e1000_spi.c @@ -399,7 +399,7 @@ static int do_e1000_spi_dump(struct cmd_tbl *cmdtp, struct e1000_hw *hw, } /* Parse the arguments */ - dest = (void *)simple_strtoul(argv[0], NULL, 16); + dest = (void *)hextoul(argv[0], NULL); offset = simple_strtoul(argv[1], NULL, 0); length = simple_strtoul(argv[2], NULL, 0); @@ -444,7 +444,7 @@ static int do_e1000_spi_program(struct cmd_tbl *cmdtp, struct e1000_hw *hw, } /* Parse the arguments */ - source = (const void *)simple_strtoul(argv[0], NULL, 16); + source = (const void *)hextoul(argv[0], NULL); offset = simple_strtoul(argv[1], NULL, 0); length = simple_strtoul(argv[2], NULL, 0); diff --git a/drivers/net/fm/fdt.c b/drivers/net/fm/fdt.c index 242d27a34e..3855d7d58f 100644 --- a/drivers/net/fm/fdt.c +++ b/drivers/net/fm/fdt.c @@ -42,7 +42,7 @@ void fdt_fixup_fman_firmware(void *blob) if (!p) return; - fmanfw = (struct qe_firmware *)simple_strtoul(p, NULL, 16); + fmanfw = (struct qe_firmware *)hextoul(p, NULL); if (!fmanfw) return; diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index 914ec001ec..3712221eba 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -956,8 +956,7 @@ unsigned long mc_get_dram_block_size(void) char *dram_block_size_env_var = env_get(MC_MEM_SIZE_ENV_VAR); if (dram_block_size_env_var) { - dram_block_size = simple_strtoul(dram_block_size_env_var, NULL, - 16); + dram_block_size = hextoul(dram_block_size_env_var, NULL); if (dram_block_size < CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE) { printf("fsl-mc: WARNING: Invalid value for \'" diff --git a/drivers/net/pfe_eth/pfe_cmd.c b/drivers/net/pfe_eth/pfe_cmd.c index 364750f65c..2fe0db0fe7 100644 --- a/drivers/net/pfe_eth/pfe_cmd.c +++ b/drivers/net/pfe_eth/pfe_cmd.c @@ -41,7 +41,7 @@ static void pfe_command_pe(int argc, char *const argv[]) } id = simple_strtoul(argv[4], NULL, 0); - addr = simple_strtoul(argv[5], NULL, 16); + addr = hextoul(argv[5], NULL); size = 4; for (i = 0; i < num; i++, addr += 4) { @@ -75,7 +75,7 @@ static void pfe_command_pe(int argc, char *const argv[]) } id = simple_strtoul(argv[4], NULL, 0); - addr = simple_strtoul(argv[5], NULL, 16); + addr = hextoul(argv[5], NULL); size = 4; for (i = 0; i < num; i++, addr += 4) { @@ -99,9 +99,9 @@ static void pfe_command_pe(int argc, char *const argv[]) } id = simple_strtoul(argv[4], NULL, 0); - val = simple_strtoul(argv[5], NULL, 16); + val = hextoul(argv[5], NULL); val = cpu_to_be32(val); - addr = simple_strtoul(argv[6], NULL, 16); + addr = hextoul(argv[6], NULL); size = 4; pe_dmem_write(id, val, addr, size); } else { @@ -123,7 +123,7 @@ static void pfe_command_pe(int argc, char *const argv[]) return; } - offset = simple_strtoul(argv[4], NULL, 16); + offset = hextoul(argv[4], NULL); for (i = 0; i < num; i++, offset += 4) { pe_lmem_read(&val, 4, offset); @@ -141,9 +141,9 @@ static void pfe_command_pe(int argc, char *const argv[]) return; } - val = simple_strtoul(argv[4], NULL, 16); + val = hextoul(argv[4], NULL); val = cpu_to_be32(val); - offset = simple_strtoul(argv[5], NULL, 16); + offset = hextoul(argv[5], NULL); pe_lmem_write(&val, 4, offset); } else { printf("Usage: pfe pe lmem [read | write] <parameters>\n"); diff --git a/drivers/net/phy/b53.c b/drivers/net/phy/b53.c index 21da53c7e5..695fac47b6 100644 --- a/drivers/net/phy/b53.c +++ b/drivers/net/phy/b53.c @@ -646,8 +646,8 @@ int do_b53_reg_read(const char *name, int argc, char *const argv[]) return ret; } - page = simple_strtoul(argv[1], NULL, 16); - offset = simple_strtoul(argv[2], NULL, 16); + page = hextoul(argv[1], NULL); + offset = hextoul(argv[2], NULL); width = simple_strtoul(argv[3], NULL, 10); switch (width) { @@ -698,13 +698,13 @@ int do_b53_reg_write(const char *name, int argc, char *const argv[]) return ret; } - page = simple_strtoul(argv[1], NULL, 16); - offset = simple_strtoul(argv[2], NULL, 16); + page = hextoul(argv[1], NULL); + offset = hextoul(argv[2], NULL); width = simple_strtoul(argv[3], NULL, 10); if (width == 48 || width == 64) value64 = simple_strtoull(argv[4], NULL, 16); else - value = simple_strtoul(argv[4], NULL, 16); + value = hextoul(argv[4], NULL); switch (width) { case 8: diff --git a/drivers/net/phy/mv88e6352.c b/drivers/net/phy/mv88e6352.c index 62a7f19214..07a8e50b48 100644 --- a/drivers/net/phy/mv88e6352.c +++ b/drivers/net/phy/mv88e6352.c @@ -256,7 +256,7 @@ int do_mvsw_reg_write(const char *name, int argc, char *const argv[]) phyaddr = simple_strtoul(argv[1], NULL, 10); port = simple_strtoul(argv[2], NULL, 10); reg = simple_strtoul(argv[3], NULL, 10); - value = simple_strtoul(argv[4], NULL, 16); + value = hextoul(argv[4], NULL); ret = sw_reg_write(name, phyaddr, port, reg, value); |