lib: Add support for a decimal 0t prefix for numbers
Subsystems (34)
v2 cover lib: Add support for a decimal 0t prefix for numbers
U-Boot mostly uses hex for value input, largely because addresses are much easier to understand in hex.
But in some cases a hex value is requested, but it is more convenient to provide a decimal value. This may be because the value comes from another source, where its base cannot be controlled.
This series adds support for a 0m prefix to indicate a decimal number. The letter 'n' is chosen because:
- 'n' (Number) is easier to read than 'm' and is currently the first search on Google for '0t prefix' (Microsoft masm)
- cannot use a-f since they indicate a hex value (e.g. 0d would be ambiguous)
- 'l' is harder to read since 1 and l look similar (0l123)
- 't' (as in ten) seems a bit obscure and the 't could be 'octal' which may be a better idea that 'o' for ocTal since 0o123 looks odd. Having said that, netbsd uses it in its ddb command
- 'm' as in deciMal is a little hard to read and 'm' is a bit hard to associate with decimal
At present, base prefixes are only accepted when no specific base is provided to the simple_strtoul() function, i.e. base is 0. This is not very flexible, so this series updates the code to always allow a base prefix. So when decimal is requested, it is possible to provide 0x123 to get a hex value.
A final patch is included for discussion only. This is intended to change the default to hex consistently through U-Boot, although it does not quite accomplish that. If this goal is desirable, then we should also consider:
- dropping the base argument, since callers can now hextoul() and dectoul() when a specific base is requested
- converting these calls (with base == 0) to hextoul() since that is what would mean
Changes in v2:
- Add an SPDX header to the file too
- Use 0n instead for the decimal prefix
- Drop 0o feature and octal support
Simon Glass (14):
hash: Ensure verification hex pairs are terminated
global: Convert simple_strtoul() with hex to hextoul()
global: Convert simple_strtoul() with decimal to dectoul()
lib: Comment the base parameter with simple_strtoul/l()
lib: Drop unnecessary check for hex digit
lib: Add tests for simple_strtoull()
lib: Add octal tests for simple_strtoul/l()
lib: Move common digit-parsing code into a function
doc: Convert command-line info to rST
doc: Add a note about number representation
lib: Allow using 0x when a decimal value is requested
lib: Support a decimal prefix 0n
lib: Drop octal support
RFC: Change simple_strtoul() et al to default to hex
README | 41 ------- arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 12 +- arch/arm/cpu/armv8/fsl-layerscape/soc.c | 2 +- arch/arm/lib/semihosting.c | 2 +- arch/arm/mach-imx/cmd_dek.c | 6 +- arch/arm/mach-imx/cmd_mfgprot.c | 4 +- arch/arm/mach-imx/cmd_nandbcb.c | 10 +- arch/arm/mach-imx/hab.c | 6 +- arch/arm/mach-imx/imx8/ahab.c | 2 +- arch/arm/mach-imx/imx8/snvs_security_sc.c | 56 +++++----- arch/arm/mach-imx/imx_bootaux.c | 2 +- arch/arm/mach-imx/mx6/mp.c | 2 +- arch/arm/mach-keystone/cmd_clock.c | 10 +- arch/arm/mach-keystone/cmd_mon.c | 8 +- arch/arm/mach-kirkwood/cpu.c | 2 +- arch/arm/mach-nexell/clock.c | 2 +- arch/arm/mach-snapdragon/misc.c | 2 +- arch/arm/mach-socfpga/misc.c | 2 +- arch/arm/mach-socfpga/vab.c | 4 +- arch/arm/mach-stm32mp/cmd_stm32key.c | 4 +- .../cmd_stm32prog/cmd_stm32prog.c | 6 +- .../mach-stm32mp/cmd_stm32prog/stm32prog.c | 2 +- arch/arm/mach-uniphier/board_late_init.c | 2 +- arch/arm/mach-zynqmp/mp.c | 2 +- arch/mips/mach-octeon/bootoctlinux.c | 5 +- arch/nds32/lib/bootm.c | 2 +- arch/nios2/lib/bootm.c | 2 +- arch/powerpc/cpu/mpc83xx/ecc.c | 18 +-- arch/powerpc/cpu/mpc85xx/mp.c | 2 +- arch/sh/lib/zimageboot.c | 5 +- arch/x86/lib/zimage.c | 14 +-- board/Arcturus/ucp1020/ucp1020.c | 2 +- board/BuS/eb_cpu5282/eb_cpu5282.c | 10 +- board/Marvell/octeontx2/board.c | 2 +- board/amlogic/beelink-s922x/beelink-s922x.c | 2 +- board/amlogic/odroid-n2/odroid-n2.c | 2 +- board/amlogic/vim3/vim3.c | 2 +- board/atmel/common/board.c | 2 +- board/bluewater/gurnard/gurnard.c | 2 +- board/cavium/thunderx/atf.c | 32 +++--- board/compulab/common/eeprom.c | 2 +- board/compulab/common/omap3_display.c | 2 +- board/davinci/da8xxevm/da850evm.c | 2 +- board/esd/meesc/meesc.c | 2 +- board/freescale/common/cmd_esbc_validate.c | 2 +- board/freescale/common/fsl_validate.c | 2 +- board/freescale/common/pixis.c | 8 +- board/freescale/common/sys_eeprom.c | 6 +- board/freescale/lx2160a/eth_lx2160aqds.c | 2 +- board/freescale/lx2160a/eth_lx2162aqds.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p2041rdb/cpld.c | 4 +- board/gateworks/gw_ventana/common.c | 2 +- board/gateworks/gw_ventana/gsc.c | 4 +- board/gateworks/gw_ventana/gw_ventana.c | 4 +- board/gateworks/venice/gsc.c | 2 +- board/gdsys/common/cmd_ioloop.c | 16 +-- board/gdsys/common/osd.c | 18 +-- board/gdsys/common/osd_cmd.c | 16 +-- board/keymile/common/common.c | 4 +- board/kontron/sl28/cmds.c | 2 +- board/menlo/m53menlo/m53menlo.c | 2 +- board/renesas/stout/cpld.c | 4 +- board/renesas/ulcb/cpld.c | 4 +- board/samsung/common/exynos5-dt.c | 2 +- board/samsung/odroid/odroid.c | 2 +- board/siemens/common/factoryset.c | 14 +-- board/siemens/taurus/taurus.c | 5 +- .../unmatched/hifive-platform-i2c-eeprom.c | 8 +- board/synopsys/hsdk/env-lib.c | 4 +- board/ti/am64x/evm.c | 2 +- board/ti/j721e/evm.c | 2 +- board/toradex/common/tdx-cfg-block.c | 14 +-- board/varisys/common/sys_eeprom.c | 6 +- .../work_92105/work_92105_display.c | 3 +- board/xilinx/common/fru.c | 4 +- board/xilinx/versal/cmds.c | 2 +- board/xilinx/zynq/cmds.c | 14 +-- board/xilinx/zynqmp/cmds.c | 46 ++++---- cmd/abootimg.c | 2 +- cmd/adtimg.c | 2 +- cmd/aes.c | 10 +- cmd/armflash.c | 2 +- cmd/avb.c | 26 ++--- cmd/axi.c | 18 +-- cmd/bedbug.c | 6 +- cmd/bind.c | 4 +- cmd/binop.c | 8 +- cmd/blk_common.c | 16 +-- cmd/blob.c | 8 +- cmd/bmp.c | 10 +- cmd/boot.c | 2 +- cmd/bootefi.c | 4 +- cmd/booti.c | 2 +- cmd/bootm.c | 4 +- cmd/bootstage.c | 4 +- cmd/bootz.c | 2 +- cmd/broadcom/nitro_image_load.c | 4 +- cmd/cbfs.c | 6 +- cmd/clk.c | 2 +- cmd/clone.c | 2 +- cmd/cramfs.c | 4 +- cmd/cros_ec.c | 8 +- cmd/demo.c | 4 +- cmd/disk.c | 2 +- cmd/efidebug.c | 14 +-- cmd/elf.c | 4 +- cmd/exit.c | 2 +- cmd/fastboot.c | 4 +- cmd/fdt.c | 41 +++---- cmd/flash.c | 16 +-- cmd/fpga.c | 10 +- cmd/fpgad.c | 6 +- cmd/gpio.c | 4 +- cmd/gpt.c | 2 +- cmd/host.c | 6 +- cmd/i2c.c | 68 ++++++------ cmd/ini.c | 8 +- cmd/io.c | 8 +- cmd/iotrace.c | 8 +- cmd/itest.c | 6 +- cmd/jffs2.c | 2 +- cmd/led.c | 2 +- cmd/legacy_led.c | 2 +- cmd/load.c | 16 +-- cmd/log.c | 4 +- cmd/lzmadec.c | 6 +- cmd/mbr.c | 2 +- cmd/md5sum.c | 14 +-- cmd/mdio.c | 2 +- cmd/mem.c | 56 +++++----- cmd/mfsl.c | 14 +-- cmd/mii.c | 8 +- cmd/misc.c | 6 +- cmd/mmc.c | 80 +++++++------- cmd/mp.c | 2 +- cmd/mtd.c | 10 +- cmd/mvebu/bubt.c | 2 +- cmd/mvebu/comphy_rx_training.c | 4 +- cmd/nand.c | 20 ++-- cmd/net.c | 6 +- cmd/nvedit.c | 12 +- cmd/nvedit_efi.c | 4 +- cmd/onenand.c | 8 +- cmd/optee_rpmb.c | 2 +- cmd/osd.c | 20 ++-- cmd/pcap.c | 4 +- cmd/pci.c | 12 +- cmd/pstore.c | 16 +-- cmd/pwm.c | 10 +- cmd/pxe_utils.c | 4 +- cmd/qfw.c | 10 +- cmd/read.c | 10 +- cmd/reiser.c | 10 +- cmd/remoteproc.c | 10 +- cmd/rng.c | 2 +- cmd/rtc.c | 14 +-- cmd/sata.c | 2 +- cmd/setexpr.c | 4 +- cmd/sf.c | 10 +- cmd/sleep.c | 2 +- cmd/smccc.c | 16 +-- cmd/sound.c | 4 +- cmd/source.c | 2 +- cmd/spi.c | 10 +- cmd/strings.c | 4 +- cmd/ti/ddr3.c | 10 +- cmd/ti/pd.c | 4 +- cmd/tlv_eeprom.c | 2 +- cmd/tpm-common.c | 4 +- cmd/trace.c | 4 +- cmd/tsi148.c | 10 +- cmd/ubi.c | 10 +- cmd/ubifs.c | 4 +- cmd/ufs.c | 2 +- cmd/universe.c | 12 +- cmd/unlz4.c | 6 +- cmd/unzip.c | 12 +- cmd/usb.c | 6 +- cmd/w1.c | 8 +- cmd/x86/mtrr.c | 6 +- cmd/ximg.c | 6 +- cmd/yaffs2.c | 10 +- cmd/zfs.c | 6 +- cmd/zip.c | 8 +- common/bedbug.c | 4 +- common/bootm_os.c | 5 +- common/fdt_support.c | 2 +- common/hash.c | 14 +-- common/image-fdt.c | 6 +- common/image-fit.c | 2 +- common/image.c | 12 +- common/kallsyms.c | 2 +- common/lcd.c | 2 +- common/lcd_console.c | 4 +- common/splash.c | 4 +- common/splash_source.c | 2 +- common/update.c | 2 +- disk/part.c | 6 +- disk/part_amiga.c | 4 +- doc/usage/cmdline.rst | 91 +++++++++++++++ doc/usage/index.rst | 1 + drivers/dfu/dfu_mmc.c | 2 +- drivers/dfu/dfu_mtd.c | 6 +- drivers/dfu/dfu_nand.c | 8 +- drivers/dfu/dfu_ram.c | 4 +- drivers/dfu/dfu_sf.c | 8 +- drivers/dfu/dfu_virt.c | 2 +- drivers/fastboot/fb_command.c | 2 +- drivers/gpio/gpio-uclass.c | 2 +- drivers/gpio/mxs_gpio.c | 4 +- drivers/gpio/pca953x.c | 4 +- drivers/gpio/tca642x.c | 4 +- drivers/misc/ds4510.c | 10 +- drivers/net/e1000.c | 2 +- drivers/net/e1000_spi.c | 4 +- drivers/net/fm/fdt.c | 2 +- drivers/net/fsl-mc/mc.c | 5 +- drivers/net/netconsole.c | 6 +- drivers/net/pfe_eth/pfe_cmd.c | 14 +-- drivers/net/pfe_eth/pfe_firmware.c | 2 +- drivers/net/phy/b53.c | 14 +-- drivers/net/phy/mv88e6352.c | 14 +-- drivers/net/qe/dm_qe_uec.c | 4 +- drivers/pinctrl/nexell/pinctrl-nexell.c | 2 +- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/power/power_core.c | 6 +- drivers/qe/qe.c | 4 +- drivers/ram/octeon/octeon_ddr.c | 2 +- drivers/rtc/m41t60.c | 2 +- drivers/serial/serial-uclass.c | 2 +- drivers/serial/serial.c | 2 +- drivers/usb/cdns3/gadget.c | 2 +- drivers/usb/gadget/epautoconf.c | 2 +- drivers/usb/gadget/ether.c | 3 +- drivers/video/ati_radeon_fb.c | 2 +- drivers/video/cfb_console.c | 2 +- drivers/video/mx3fb.c | 2 +- drivers/video/vidconsole-uclass.c | 4 +- examples/standalone/atmel_df_pow2.c | 5 +- fs/fs.c | 14 +-- include/vsprintf.h | 70 +++++++++++- lib/dhry/cmd_dhry.c | 2 +- lib/fdtdec.c | 2 +- lib/net_utils.c | 4 +- lib/strto.c | 76 +++++++++---- lib/uuid.c | 14 +-- lib/vsprintf.c | 2 +- net/bootp.c | 2 +- net/eth-uclass.c | 4 +- net/eth_legacy.c | 2 +- net/net.c | 2 +- net/tftp.c | 13 +-- test/py/tests/test_hush_if_test.py | 11 -- test/str_ut.c | 104 +++++++++++++++++- 255 files changed, 1187 insertions(+), 961 deletions(-) create mode 100644 doc/usage/cmdline.rst
Signature · 1 line
2.32.0.432.gabb21c7263-goog
PATCH v2 1/14 hash: Ensure verification hex pairs are terminated
This function seems to assume that the chr[] variable contains zeros at the start, which is not always true. Use strlcpy() to be safe.
---
(no changes since v1)
common/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/hash.c +1 -1
@@ -396,7 +396,7 @@ int hash_parse_string(const char *algo_name, const char *str, uint8_t *result)for (i =0 ; i < algo->digest_size; i++) {char chr[3 ]; -strncpy (chr, &str[i *2 ],2 ); +strlcpy (chr, &str[i *2 ],3 ); result[i] =simple_strtoul (chr,NULL ,16 ); }
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 01/14] hash: Ensure verification hex pairs are terminated
Quoted 4 lines · Simon Glass
This function seems to assume that the chr[] variable contains zeros at the start, which is not always true. Use
strlcpy()to be safe.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 2/14 global: Convert simple_strtoul() with hex to hextoul()
In reply to Simon GlassIt 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.
---
(no changes since v1)
arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 12 ++-- arch/arm/lib/semihosting.c | 2 +- arch/arm/mach-imx/cmd_dek.c | 4 +- arch/arm/mach-imx/cmd_mfgprot.c | 2 +- arch/arm/mach-imx/cmd_nandbcb.c | 10 ++-- arch/arm/mach-imx/hab.c | 6 +- arch/arm/mach-imx/imx8/ahab.c | 2 +- arch/arm/mach-imx/imx8/snvs_security_sc.c | 54 ++++++++--------- arch/arm/mach-imx/imx_bootaux.c | 2 +- arch/arm/mach-imx/mx6/mp.c | 2 +- arch/arm/mach-keystone/cmd_mon.c | 8 +-- arch/arm/mach-snapdragon/misc.c | 2 +- arch/arm/mach-socfpga/misc.c | 2 +- arch/arm/mach-socfpga/vab.c | 4 +- arch/arm/mach-stm32mp/cmd_stm32key.c | 4 +- .../cmd_stm32prog/cmd_stm32prog.c | 4 +- arch/arm/mach-uniphier/board_late_init.c | 2 +- arch/arm/mach-zynqmp/mp.c | 2 +- arch/mips/mach-octeon/bootoctlinux.c | 5 +- arch/nds32/lib/bootm.c | 2 +- arch/nios2/lib/bootm.c | 2 +- arch/powerpc/cpu/mpc83xx/ecc.c | 14 ++--- arch/powerpc/cpu/mpc85xx/mp.c | 2 +- arch/sh/lib/zimageboot.c | 5 +- arch/x86/lib/zimage.c | 14 ++--- board/BuS/eb_cpu5282/eb_cpu5282.c | 2 +- board/Marvell/octeontx2/board.c | 2 +- board/amlogic/beelink-s922x/beelink-s922x.c | 2 +- board/amlogic/odroid-n2/odroid-n2.c | 2 +- board/amlogic/vim3/vim3.c | 2 +- board/bluewater/gurnard/gurnard.c | 2 +- board/cavium/thunderx/atf.c | 8 +-- board/esd/meesc/meesc.c | 2 +- board/freescale/common/cmd_esbc_validate.c | 2 +- board/freescale/common/fsl_validate.c | 2 +- board/freescale/common/sys_eeprom.c | 4 +- board/freescale/lx2160a/eth_lx2160aqds.c | 2 +- board/freescale/lx2160a/eth_lx2162aqds.c | 2 +- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- board/freescale/p2041rdb/cpld.c | 4 +- board/gateworks/gw_ventana/common.c | 2 +- board/gateworks/gw_ventana/gw_ventana.c | 2 +- board/gdsys/common/osd.c | 18 +++--- board/gdsys/common/osd_cmd.c | 16 ++--- board/keymile/common/common.c | 4 +- board/kontron/sl28/cmds.c | 2 +- board/menlo/m53menlo/m53menlo.c | 2 +- board/renesas/stout/cpld.c | 4 +- board/renesas/ulcb/cpld.c | 4 +- board/siemens/common/factoryset.c | 14 ++--- .../unmatched/hifive-platform-i2c-eeprom.c | 2 +- board/synopsys/hsdk/env-lib.c | 2 +- board/ti/am64x/evm.c | 2 +- board/ti/j721e/evm.c | 2 +- board/varisys/common/sys_eeprom.c | 4 +- board/xilinx/common/fru.c | 4 +- board/xilinx/versal/cmds.c | 2 +- board/xilinx/zynq/cmds.c | 14 ++--- board/xilinx/zynqmp/cmds.c | 46 +++++++------- cmd/abootimg.c | 2 +- cmd/adtimg.c | 2 +- cmd/aes.c | 10 ++-- cmd/armflash.c | 2 +- cmd/avb.c | 24 ++++---- cmd/axi.c | 10 ++-- cmd/bedbug.c | 6 +- cmd/binop.c | 6 +- cmd/blk_common.c | 12 ++-- cmd/blob.c | 8 +-- cmd/bmp.c | 6 +- cmd/boot.c | 2 +- cmd/bootefi.c | 4 +- cmd/booti.c | 2 +- cmd/bootm.c | 4 +- cmd/bootstage.c | 4 +- cmd/bootz.c | 2 +- cmd/broadcom/nitro_image_load.c | 4 +- cmd/cbfs.c | 6 +- cmd/cramfs.c | 4 +- cmd/cros_ec.c | 4 +- cmd/demo.c | 2 +- cmd/disk.c | 2 +- cmd/efidebug.c | 14 ++--- cmd/elf.c | 4 +- cmd/fastboot.c | 4 +- cmd/fdt.c | 41 ++++++------- cmd/flash.c | 10 ++-- cmd/fpga.c | 10 ++-- cmd/fpgad.c | 6 +- cmd/host.c | 6 +- cmd/i2c.c | 60 +++++++++---------- cmd/ini.c | 8 +-- cmd/io.c | 8 +-- cmd/iotrace.c | 8 +-- cmd/itest.c | 6 +- cmd/jffs2.c | 2 +- cmd/load.c | 10 ++-- cmd/lzmadec.c | 6 +- cmd/md5sum.c | 14 ++--- cmd/mdio.c | 2 +- cmd/mem.c | 52 ++++++++-------- cmd/mfsl.c | 14 ++--- cmd/mii.c | 8 +-- cmd/misc.c | 6 +- cmd/mmc.c | 40 ++++++------- cmd/mtd.c | 10 ++-- cmd/mvebu/bubt.c | 2 +- cmd/mvebu/comphy_rx_training.c | 4 +- cmd/nand.c | 18 +++--- cmd/net.c | 6 +- cmd/nvedit.c | 10 ++-- cmd/nvedit_efi.c | 4 +- cmd/onenand.c | 8 +-- cmd/osd.c | 16 ++--- cmd/pcap.c | 2 +- cmd/pci.c | 12 ++-- cmd/pstore.c | 14 ++--- cmd/pxe_utils.c | 4 +- cmd/qfw.c | 10 ++-- cmd/read.c | 10 ++-- cmd/reiser.c | 10 ++-- cmd/remoteproc.c | 4 +- cmd/rng.c | 2 +- cmd/rtc.c | 12 ++-- cmd/setexpr.c | 4 +- cmd/sf.c | 10 ++-- cmd/smccc.c | 16 ++--- cmd/source.c | 2 +- cmd/strings.c | 4 +- cmd/ti/ddr3.c | 10 ++-- cmd/tlv_eeprom.c | 2 +- cmd/tpm-common.c | 2 +- cmd/trace.c | 4 +- cmd/tsi148.c | 10 ++-- cmd/ubi.c | 10 ++-- cmd/ubifs.c | 4 +- cmd/universe.c | 12 ++-- cmd/unlz4.c | 6 +- cmd/unzip.c | 12 ++-- cmd/x86/mtrr.c | 6 +- cmd/ximg.c | 6 +- cmd/yaffs2.c | 10 ++-- cmd/zfs.c | 6 +- cmd/zip.c | 8 +-- common/bedbug.c | 2 +- common/bootm_os.c | 5 +- common/fdt_support.c | 2 +- common/hash.c | 12 ++-- common/image-fdt.c | 6 +- common/image-fit.c | 2 +- common/image.c | 12 ++-- common/kallsyms.c | 2 +- common/lcd.c | 2 +- common/splash.c | 4 +- common/splash_source.c | 2 +- common/update.c | 2 +- disk/part.c | 6 +- drivers/dfu/dfu_mtd.c | 4 +- drivers/dfu/dfu_nand.c | 4 +- drivers/dfu/dfu_ram.c | 4 +- drivers/dfu/dfu_sf.c | 4 +- drivers/fastboot/fb_command.c | 2 +- drivers/gpio/pca953x.c | 4 +- drivers/misc/ds4510.c | 10 ++-- drivers/net/e1000_spi.c | 4 +- drivers/net/fm/fdt.c | 2 +- drivers/net/fsl-mc/mc.c | 3 +- drivers/net/pfe_eth/pfe_cmd.c | 14 ++--- drivers/net/phy/b53.c | 10 ++-- drivers/net/phy/mv88e6352.c | 2 +- drivers/power/power_core.c | 6 +- drivers/qe/qe.c | 4 +- drivers/rtc/m41t60.c | 2 +- drivers/video/ati_radeon_fb.c | 2 +- drivers/video/cfb_console.c | 2 +- drivers/video/mx3fb.c | 2 +- fs/fs.c | 14 ++--- include/vsprintf.h | 28 ++++++++- lib/net_utils.c | 2 +- lib/strto.c | 12 ++-- lib/uuid.c | 14 ++--- lib/vsprintf.c | 2 +- test/str_ut.c | 12 ++++ 183 files changed, 692 insertions(+), 659 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/fdt.c +6 -6
@@ -565,28 +565,28 @@ void fdt_fixup_pfe_firmware(void *blob)if (!p)return ; - pclassfw = (void *)simple_strtoul (p,NULL ,16 ); + pclassfw = (void *)hextoul (p,NULL );if (!pclassfw)return ; p =env_get ("class_elf_size" );if (!p)return ; - len_class =simple_strtoul (p,NULL ,16 ); + len_class =hextoul (p,NULL );/* If the environment variable is not set, then exit silently */ p =env_get ("tmu_elf_firmware" );if (!p)return ; - ptmufw = (void *)simple_strtoul (p,NULL ,16 ); + ptmufw = (void *)hextoul (p,NULL );if (!ptmufw)return ; p =env_get ("tmu_elf_size" );if (!p)return ; - len_tmu =simple_strtoul (p,NULL ,16 ); + len_tmu =hextoul (p,NULL );if (len_class ==0 || len_tmu ==0 ) { printf("PFE FW corrupted. CLASS FW size %d, TMU FW size %d\n",
@@ -605,14 +605,14 @@ void fdt_fixup_pfe_firmware(void *blob)if (!p)return ; - putilfw = (void *)simple_strtoul (p,NULL ,16 ); + putilfw = (void *)hextoul (p,NULL );if (!putilfw)return ; p =env_get ("util_elf_size" );if (!p)return ; - len_util =simple_strtoul (p,NULL ,16 ); + len_util =hextoul (p,NULL );if (len_util) {printf ("PFE Util PE firmware is not added to FDT.\n" );
arch/arm/lib/semihosting.c +1 -1
@@ -191,7 +191,7 @@ static int do_smhload(struct cmd_tbl *cmdtp, int flag, int argc,int ret;char end_str[64 ]; - load_addr =simple_strtoul (argv[2 ],NULL ,16 ); + load_addr =hextoul (argv[2 ],NULL );if (!load_addr)return -1 ;
arch/arm/mach-imx/cmd_dek.c +2 -2
@@ -300,8 +300,8 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=4 )return CMD_RET_USAGE ; - src_addr =simple_strtoul (argv[1 ],NULL ,16 ); - dst_addr =simple_strtoul (argv[2 ],NULL ,16 ); + src_addr =hextoul (argv[1 ],NULL ); + dst_addr =hextoul (argv[2 ],NULL ); len =simple_strtoul (argv[3 ],NULL ,10 );return blob_encap_dek (src_addr, dst_addr, len);
arch/arm/mach-imx/cmd_mfgprot.c +1 -1
@@ -71,7 +71,7 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])if (argc !=4 )return CMD_RET_USAGE ; - m_addr =simple_strtoul (argv[2 ],NULL ,16 ); + m_addr =hextoul (argv[2 ],NULL ); m_size =simple_strtoul (argv[3 ],NULL ,10 ); m_ptr =map_physmem (m_addr, m_size,MAP_NOCACHE );if (!m_ptr)
arch/arm/mach-imx/cmd_nandbcb.c +5 -5
@@ -1083,13 +1083,13 @@ static int do_nandbcb_bcbonly(int argc, char *const argv[]) mtd = cfg.mtd; - cfg.boot_stream1_address =simple_strtoul (argv[2 ],NULL ,16 ); - cfg.boot_stream1_size =simple_strtoul (argv[3 ],NULL ,16 ); + cfg.boot_stream1_address =hextoul (argv[2 ],NULL ); + cfg.boot_stream1_size =hextoul (argv[3 ],NULL ); cfg.boot_stream1_size =ALIGN (cfg.boot_stream1_size, mtd->writesize);if (argc >5 ) { - cfg.boot_stream2_address =simple_strtoul (argv[4 ],NULL ,16 ); - cfg.boot_stream2_size =simple_strtoul (argv[5 ],NULL ,16 ); + cfg.boot_stream2_address =hextoul (argv[4 ],NULL ); + cfg.boot_stream2_size =hextoul (argv[5 ],NULL ); cfg.boot_stream2_size =ALIGN (cfg.boot_stream2_size, mtd->writesize); }
@@ -1450,7 +1450,7 @@ static int do_nandbcb_init(int argc, char * const argv[])if (nandbcb_set_boot_config (argc, argv, &cfg))return CMD_RET_FAILURE ; - addr =simple_strtoul (argv[1 ], &endp,16 ); + addr =hextoul (argv[1 ], &endp);if (*argv[1 ] ==0 || *endp !=0 )return CMD_RET_FAILURE ;
arch/arm/mach-imx/hab.c +3 -3
@@ -609,12 +609,12 @@ static int do_authenticate_image(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); - length =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); + length =hextoul (argv[2 ],NULL );if (argc ==3 ) ivt_offset =get_image_ivt_offset (addr);else - ivt_offset =simple_strtoul (argv[3 ],NULL ,16 ); + ivt_offset =hextoul (argv[3 ],NULL ); rcode =imx_hab_authenticate_image (addr, length, ivt_offset);if (rcode ==0 )
arch/arm/mach-imx/imx8/ahab.c +1 -1
@@ -161,7 +161,7 @@ static int do_authenticate(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <2 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );printf ("Authenticate OS container at 0x%lx\n" , addr);
arch/arm/mach-imx/imx8/snvs_security_sc.c +27 -27
78 lines not on this page · raw message
arch/arm/mach-imx/imx_bootaux.c +1 -1
@@ -180,7 +180,7 @@ static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_SUCCESS ; } - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );if (!addr)return CMD_RET_FAILURE ;
arch/arm/mach-imx/mx6/mp.c +1 -1
@@ -47,7 +47,7 @@ int cpu_release(u32 nr, int argc, char *const argv[]) {uint32_t boot_addr; - boot_addr =simple_strtoul (argv[0 ],NULL ,16 ); + boot_addr =hextoul (argv[0 ],NULL );switch (nr) {case 1 :
arch/arm/mach-keystone/cmd_mon.c +4 -4
@@ -25,7 +25,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc, freq =CONFIG_SYS_HZ_CLOCK ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); header = (struct image_header *)addr;
@@ -40,7 +40,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc, size);if (argc >=3 ) - ecrypt_bm_addr =simple_strtoul (argv[2 ],NULL ,16 ); + ecrypt_bm_addr =hextoul (argv[2 ],NULL ); rcode =mon_install (load_addr, dpsc_base, freq, ecrypt_bm_addr); printf("## installed monitor @ 0x%x, freq [%d], status %d\n",
@@ -76,8 +76,8 @@ int do_mon_power(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - core_id =simple_strtoul (argv[1 ],NULL ,16 ); - on =simple_strtoul (argv[2 ],NULL ,16 ); + core_id =hextoul (argv[1 ],NULL ); + on =hextoul (argv[2 ],NULL );if (on) rcode =mon_power_on (core_id, fn);
arch/arm/mach-snapdragon/misc.c +1 -1
@@ -47,7 +47,7 @@ void msm_generate_mac_addr(u8 *mac) mac[0 ] =0x02 ; mac[1 ] =00 ;for (i =3 ; i >=0 ; i--) { - mac[i +2 ] =simple_strtoul (&sn[2 * i],NULL ,16 ); + mac[i +2 ] =hextoul (&sn[2 * i],NULL ); sn[2 * i] =0 ; } }
arch/arm/mach-socfpga/misc.c +1 -1
@@ -191,7 +191,7 @@ static int do_bridge(struct cmd_tbl *cmdtp, int flag, int argc, argv++;if (argc ==3 ) - mask =simple_strtoul (argv[1 ],NULL ,16 ); + mask =hextoul (argv[1 ],NULL );switch (*argv[0 ]) {case 'e' :/* Enable */
arch/arm/mach-socfpga/vab.c +2 -2
@@ -17,8 +17,8 @@ static int do_vab(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); - len =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); + len =hextoul (argv[2 ],NULL );if (socfpga_vendor_authentication ((void *)&addr, (size_t *)&len) !=0 )return CMD_RET_FAILURE ;
arch/arm/mach-stm32mp/cmd_stm32key.c +2 -2
@@ -162,7 +162,7 @@ static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *conreturn CMD_RET_SUCCESS ; } - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );if (!addr)return CMD_RET_USAGE ;
@@ -185,7 +185,7 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con yes = true; } - addr =simple_strtoul (argv[argc -1 ],NULL ,16 ); + addr =hextoul (argv[argc -1 ],NULL );if (!addr)return CMD_RET_USAGE ;
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +2 -2
@@ -64,12 +64,12 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, addr =STM32_DDR_BASE ; size =0 ;if (argc >3 ) { - addr =simple_strtoul (argv[3 ],NULL ,16 ); + addr =hextoul (argv[3 ],NULL );if (!addr)return CMD_RET_FAILURE ; }if (argc >4 ) - size =simple_strtoul (argv[4 ],NULL ,16 ); + size =hextoul (argv[4 ],NULL );/* check STM32IMAGE presence */ if (size ==0 ) {
arch/arm/mach-uniphier/board_late_init.c +1 -1
@@ -66,7 +66,7 @@ static void uniphier_set_env_addr(const char *env, const char *offset_env)if (!str) goto fail; - offset =simple_strtoul (str, &end,16 ); + offset =hextoul (str, &end);if (*end) goto fail; }
arch/arm/mach-zynqmp/mp.c +1 -1
@@ -252,7 +252,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])return 1 ; } -u32 boot_addr =simple_strtoul (argv[0 ],NULL ,16 ); +u32 boot_addr =hextoul (argv[0 ],NULL );u32 boot_addr_uniq =0 ;if (!(boot_addr ==ZYNQMP_R5_LOVEC_ADDR || boot_addr ==ZYNQMP_R5_HIVEC_ADDR )) {
arch/mips/mach-octeon/bootoctlinux.c +2 -3
@@ -281,8 +281,7 @@ int octeon_parse_bootopts(int argc, char *const argv[], }else if (!strncmp (argv[arg],"forceboot" ,9 )) { boot_args->forceboot = true; }else if (!strncmp (argv[arg],"nodemask=" ,9 )) { - boot_args->node_mask =simple_strtoul (argv[arg] +9 , -NULL ,16 ); + boot_args->node_mask =hextoul (argv[arg] +9 ,NULL ); }else if (!strncmp (argv[arg],"numcores=" ,9 )) {memset (node_values,0 ,sizeof (node_values)); num_values = octeon_parse_nodes(node_values,
@@ -383,7 +382,7 @@ int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc, argv[1][1] == 'x' || argv[1][1] == 'X' || argv[1][1] == '\0'))) { - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );if (!addr) addr =CONFIG_SYS_LOAD_ADDR ; arg_start++;
arch/nds32/lib/bootm.c +1 -1
@@ -64,7 +64,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) s =env_get ("machid" );if (s) { - machid =simple_strtoul (s,NULL ,16 ); + machid =hextoul (s,NULL );printf ("Using machid 0x%x from environment\n" , machid); }
arch/nios2/lib/bootm.c +1 -1
@@ -27,7 +27,7 @@ int do_bootm_linux(int flag, int argc, char *const argv[], of_flat_tree = images->ft_addr;#endif if (!of_flat_tree && argc >1 ) - of_flat_tree = (char *)simple_strtoul (argv[1 ],NULL ,16 ); + of_flat_tree = (char *)hextoul (argv[1 ],NULL );if (of_flat_tree) initrd_end = (ulong )of_flat_tree;
arch/powerpc/cpu/mpc83xx/ecc.c +7 -7
@@ -219,17 +219,17 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ddr->err_detect = val;return 0 ; }else if (strcmp (argv[1 ],"injectdatahi" ) ==0 ) { - val =simple_strtoul (argv[2 ],NULL ,16 ); + val =hextoul (argv[2 ],NULL ); ddr->data_err_inject_hi = val;return 0 ; }else if (strcmp (argv[1 ],"injectdatalo" ) ==0 ) { - val =simple_strtoul (argv[2 ],NULL ,16 ); + val =hextoul (argv[2 ],NULL ); ddr->data_err_inject_lo = val;return 0 ; }else if (strcmp (argv[1 ],"injectecc" ) ==0 ) { - val =simple_strtoul (argv[2 ],NULL ,16 ); + val =hextoul (argv[2 ],NULL );if (val >0xff ) {printf ("Incorrect ECC inject mask, " "should be 0x00..0xff\n" );
@@ -269,8 +269,8 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }if (argc ==4 ) {if (strcmp (argv[1 ],"testdw" ) ==0 ) { - addr = (u64 *)simple_strtoul (argv[2 ],NULL ,16 ); - count =simple_strtoul (argv[3 ],NULL ,16 ); + addr = (u64 *)hextoul (argv[2 ],NULL ); + count =hextoul (argv[3 ],NULL );if ((u32 ) addr %8 ) { printf("Address not aligned on "
@@ -308,8 +308,8 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 0 ; }if (strcmp (argv[1 ],"testword" ) ==0 ) { - addr = (u64 *)simple_strtoul (argv[2 ],NULL ,16 ); - count =simple_strtoul (argv[3 ],NULL ,16 ); + addr = (u64 *)hextoul (argv[2 ],NULL ); + count =hextoul (argv[3 ],NULL );if ((u32 ) addr %8 ) { printf("Address not aligned on "
arch/powerpc/cpu/mpc85xx/mp.c +1 -1
@@ -167,7 +167,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])for (i =1 ; i <3 ; i++) {if (argv[i][0 ] !='-' ) {u8 entry = boot_entry_map[i]; - val =simple_strtoul (argv[i],NULL ,16 ); + val =hextoul (argv[i],NULL ); table[entry] = val; } }
arch/sh/lib/zimageboot.c +3 -2
@@ -37,11 +37,12 @@ int do_sh_zimageboot(struct cmd_tbl *cmdtp, int flag, int argc, }if (s0) - zboot_entry = (ulong (*)(int ,char *const []))simple_strtoul (s0,NULL ,16 ); + zboot_entry = (ulong (*)(int ,char *const []))hextoul (s0, +NULL );/* empty_zero_page */ if (s1) - param = (unsigned char *)simple_strtoul (s1,NULL ,16 ); + param = (unsigned char *)hextoul (s1,NULL );/* Linux kernel command line */ cmdline = (char *)param +COMMAND_LINE ;
arch/x86/lib/zimage.c +7 -7
@@ -405,17 +405,17 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc, }if (s) - state.bzimage_addr =simple_strtoul (s,NULL ,16 ); + state.bzimage_addr =hextoul (s,NULL );if (argc >=3 ) {/* argv[2] holds the size of the bzImage */ - state.bzimage_size =simple_strtoul (argv[2 ],NULL ,16 ); + state.bzimage_size =hextoul (argv[2 ],NULL ); }if (argc >=4 ) - state.initrd_addr =simple_strtoul (argv[3 ],NULL ,16 ); + state.initrd_addr =hextoul (argv[3 ],NULL );if (argc >=5 ) - state.initrd_size =simple_strtoul (argv[4 ],NULL ,16 ); + state.initrd_size =hextoul (argv[4 ],NULL );if (argc >=6 ) {/* * When the base_ptr is passed in, we assume that the image is
@@ -428,7 +428,7 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,* load address and set bzimage_addr to 0 so we know that it * cannot be proceesed (or processed again). */ - state.base_ptr = (void *)simple_strtoul (argv[5 ],NULL ,16 ); + state.base_ptr = (void *)hextoul (argv[5 ],NULL ); state.load_address = state.bzimage_addr; state.bzimage_addr =0 ; }
@@ -702,7 +702,7 @@ static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc,struct boot_params *base_ptr = state.base_ptr;if (argc >1 ) - base_ptr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); + base_ptr = (void *)hextoul (argv[1 ],NULL );if (!base_ptr) {printf ("No zboot setup_base\n" );return CMD_RET_FAILURE ;
@@ -749,7 +749,7 @@ int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,if (argc >1 ) {char *endp; -simple_strtoul (argv[1 ], &endp,16 ); +hextoul (argv[1 ], &endp);/* * endp pointing to nul means that argv[1] was just a valid * number, so pass it along to the normal processing
board/BuS/eb_cpu5282/eb_cpu5282.c +1 -1
@@ -214,7 +214,7 @@ int drv_video_init(void)#ifdef CONFIG_SPLASH_SCREEN s =env_get ("splashimage" );if (s !=NULL ) { - splash =simple_strtoul (s,NULL ,16 ); + splash =hextoul (s,NULL );vcxk_acknowledge_wait ();video_display_bitmap (splash,0 ,0 ); }
board/Marvell/octeontx2/board.c +1 -1
@@ -230,7 +230,7 @@ static int do_go_uboot(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <2 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); fdt =board_fdt_blob_setup (); entry = (uboot_entry_t )addr;flush_cache ((ulong )addr,1 <<20 );/* 1MiB should be enough */
board/amlogic/beelink-s922x/beelink-s922x.c +1 -1
@@ -39,7 +39,7 @@ int misc_init_r(void) tmp[0 ] = efuse_mac_addr[i *2 ]; tmp[1 ] = efuse_mac_addr[i *2 +1 ]; tmp[2 ] ='\0' ; - mac_addr[i] =simple_strtoul (tmp,NULL ,16 ); + mac_addr[i] =hextoul (tmp,NULL ); }if (is_valid_ethaddr (mac_addr))
board/amlogic/odroid-n2/odroid-n2.c +1 -1
@@ -126,7 +126,7 @@ int misc_init_r(void) tmp[0 ] = efuse_mac_addr[i *2 ]; tmp[1 ] = efuse_mac_addr[i *2 +1 ]; tmp[2 ] ='\0' ; - mac_addr[i] =simple_strtoul (tmp,NULL ,16 ); + mac_addr[i] =hextoul (tmp,NULL ); }if (is_valid_ethaddr (mac_addr))
board/amlogic/vim3/vim3.c +1 -1
@@ -160,7 +160,7 @@ int misc_init_r(void) tmp[0 ] = efuse_mac_addr[i *2 ]; tmp[1 ] = efuse_mac_addr[i *2 +1 ]; tmp[2 ] ='\0' ; - mac_addr[i] =simple_strtoul (tmp,NULL ,16 ); + mac_addr[i] =hextoul (tmp,NULL ); }if (is_valid_ethaddr (mac_addr))
board/bluewater/gurnard/gurnard.c +1 -1
@@ -376,7 +376,7 @@ int board_late_init(void)/* Parse MAC address */ for (i =0 ; i <6 ; i++) { env_enetaddr[i] = env_str ? -simple_strtoul (env_str, &end,16 ) :0 ; +hextoul (env_str, &end) :0 ;if (env_str) env_str = (*end) ? end+1 : end; }
board/cavium/thunderx/atf.c +4 -4
@@ -235,25 +235,25 @@ int do_atf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])char str[4 *sizeof (uint64_t )];if ((argc ==5 ) && !strcmp (argv[1 ],"readmmc" )) { - buffer = (void *)simple_strtoul (argv[2 ],NULL ,16 ); + buffer = (void *)hextoul (argv[2 ],NULL ); offset =simple_strtoul (argv[3 ],NULL ,10 ); size =simple_strtoul (argv[4 ],NULL ,10 ); ret =atf_read_mmc (offset, buffer, size); }else if ((argc ==5 ) && !strcmp (argv[1 ],"readnor" )) { - buffer = (void *)simple_strtoul (argv[2 ],NULL ,16 ); + buffer = (void *)hextoul (argv[2 ],NULL ); offset =simple_strtoul (argv[3 ],NULL ,10 ); size =simple_strtoul (argv[4 ],NULL ,10 ); ret =atf_read_nor (offset, buffer, size); }else if ((argc ==5 ) && !strcmp (argv[1 ],"writemmc" )) { - buffer = (void *)simple_strtoul (argv[2 ],NULL ,16 ); + buffer = (void *)hextoul (argv[2 ],NULL ); offset =simple_strtoul (argv[3 ],NULL ,10 ); size =simple_strtoul (argv[4 ],NULL ,10 ); ret =atf_write_mmc (offset, buffer, size); }else if ((argc ==5 ) && !strcmp (argv[1 ],"writenor" )) { - buffer = (void *)simple_strtoul (argv[2 ],NULL ,16 ); + buffer = (void *)hextoul (argv[2 ],NULL ); offset =simple_strtoul (argv[3 ],NULL ,10 ); size =simple_strtoul (argv[4 ],NULL ,10 );
board/esd/meesc/meesc.c +1 -1
@@ -208,7 +208,7 @@ void get_board_serial(struct tag_serialnr *serialnr) str =strchr (serial,'_' );if (str && (strlen (str) >=4 )) { serialnr->high = (*(str +1 ) <<8 ) | *(str +2 ); - serialnr->low =simple_strtoul (str +3 ,NULL ,16 ); + serialnr->low =hextoul (str +3 ,NULL ); } }else { serialnr->high =0 ;
board/freescale/common/cmd_esbc_validate.c +1 -1
@@ -40,7 +40,7 @@ static int do_esbc_validate(struct cmd_tbl *cmdtp, int flag, int argc, hash_str = argv[2 ];/* First argument - header address -32/64bit */ - haddr = (uintptr_t )simple_strtoul (argv[1 ],NULL ,16 ); + haddr = (uintptr_t )hextoul (argv[1 ],NULL );/* With esbc_validate command, Image address must be * part of header. So, the function is called
board/freescale/common/fsl_validate.c +1 -1
@@ -767,7 +767,7 @@ static inline int str2longbe(const char *p, ulong *num)if (!p) {return 0 ; }else { - tmp =simple_strtoul (p, &endptr,16 ); + tmp =hextoul (p, &endptr);if (sizeof (ulong) ==4 ) *num =cpu_to_be32 (tmp);else
board/freescale/common/sys_eeprom.c +2 -2
@@ -378,7 +378,7 @@ static void set_mac_address(unsigned int index, const char *string) }for (i =0 ; *p && (i <6 ); i++) { - e.mac[index][i] =simple_strtoul (p, &p,16 ); + e.mac[index][i] =hextoul (p, &p);if (*p ==':' ) p++; }
@@ -452,7 +452,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])set_date (argv[2 ]);break ;case 'p' :/* MAC table size */ - e.mac_count =simple_strtoul (argv[2 ],NULL ,16 ); + e.mac_count =hextoul (argv[2 ],NULL );update_crc ();break ; case '0' ... '9': /* "mac 0" through "mac 22" */
board/freescale/lx2160a/eth_lx2160aqds.c +1 -1
@@ -416,7 +416,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid, env_dpmac, phy_num + 1, arg_dpmacid); elsewriop_set_phy_address (dpmac ,phy_num , - simple_strtoul(ret, NULL, 16)); +hextoul (ret ,NULL )); }/*search mdio in dpmac arg*/
board/freescale/lx2160a/eth_lx2162aqds.c +1 -1
@@ -437,7 +437,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid, env_dpmac, phy_num + 1, arg_dpmacid); elsewriop_set_phy_address (dpmac ,phy_num , - simple_strtoul(ret, NULL, 16)); +hextoul (ret ,NULL )); }/*search mdio in dpmac arg*/
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +1 -1
@@ -281,7 +281,7 @@ int board_early_init_r(void)/* If a VSC7385 microcode image is present, then upload it. */ tmp =env_get ("vscfw_addr" );if (tmp) { - vscfw_addr =simple_strtoul (tmp,NULL ,16 ); + vscfw_addr =hextoul (tmp,NULL );printf ("uploading VSC7385 microcode from %x\n" , vscfw_addr);if (vsc7385_upload_firmware ((void *)vscfw_addr,CONFIG_VSC7385_IMAGE_SIZE ))
board/freescale/p2041rdb/cpld.c +2 -2
@@ -100,8 +100,8 @@ int cpld_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])else cpld_set_defbank (); }else if (strcmp (argv[1 ],"lane_mux" ) ==0 ) { -u32 lane =simple_strtoul (argv[2 ],NULL ,16 ); -u8 val = (u8 )simple_strtoul (argv[3 ],NULL ,16 ); +u32 lane =hextoul (argv[2 ],NULL ); +u8 val = (u8 )hextoul (argv[3 ],NULL );u8 reg =CPLD_READ (serdes_mux);switch (lane) {
board/gateworks/gw_ventana/common.c +1 -1
@@ -1502,7 +1502,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)continue ; s =hwconfig_subarg (arg,"padctrl" , &len);if (s) { - ctrl =MUX_PAD_CTRL (simple_strtoul (s,NULL ,16 ) + ctrl =MUX_PAD_CTRL (hextoul (s,NULL ) &0x1ffff ) |MUX_MODE_SION ; }if (hwconfig_subarg_cmp (arg,"mode" ,"gpio" )) {
board/gateworks/gw_ventana/gw_ventana.c +1 -1
@@ -915,7 +915,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)if (tmp) {for (j =0 ; j <6 ; j++) { mac_addr[j] = tmp ? -simple_strtoul (tmp, &end,16 ) :0 ; +hextoul (tmp, &end) :0 ;if (tmp) tmp = (*end) ? end+1 : end; }
board/gdsys/common/osd.c +9 -9
@@ -284,9 +284,9 @@ static int osd_print(struct cmd_tbl *cmdtp, int flag, int argc,if (!(osd_screen_mask & (1 << screen)))continue ; - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); - color =simple_strtoul (argv[3 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); + color =hextoul (argv[3 ],NULL ); text = argv[4 ]; charcount =strlen (text); len = (charcount > bufsize) ? bufsize : charcount;
@@ -416,13 +416,13 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])char *rp;u16 *wp = buffer;unsigned count = (argc >4 ) ? -simple_strtoul (argv[4 ],NULL ,16 ) :1 ; +hextoul (argv[4 ],NULL ) :1 ;if (!(osd_screen_mask & (1 << screen)))continue ; - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); rp = argv[3 ];
@@ -431,7 +431,7 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])memcpy (substr, rp,4 ); substr[4 ] =0 ; - *wp =simple_strtoul (substr,NULL ,16 ); + *wp =hextoul (substr,NULL ); rp +=4 ; wp++;
@@ -463,8 +463,8 @@ int osd_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL );if (!x || (x >64 ) || (x >MAX_X_CHARS ) || !y || (y >32 ) || (y >MAX_Y_CHARS )) {
board/gdsys/common/osd_cmd.c +8 -8
@@ -30,10 +30,10 @@ static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <4 || (strlen (argv[3 ])) %2 )return CMD_RET_USAGE ; - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); hexstr = argv[3 ]; - count = (argc >4 ) ?simple_strtoul (argv[4 ],NULL ,16 ) :1 ; + count = (argc >4 ) ?hextoul (argv[4 ],NULL ) :1 ; buflen =strlen (hexstr) /2 ;
@@ -80,9 +80,9 @@ static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <5 )return CMD_RET_USAGE ; - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); - color =simple_strtoul (argv[3 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); + color =hextoul (argv[3 ],NULL ); text = argv[4 ]; for (uclass_first_device(UCLASS_VIDEO_OSD, &dev);
@@ -109,8 +109,8 @@ static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); for (uclass_first_device(UCLASS_VIDEO_OSD, &dev); dev;
board/keymile/common/common.c +2 -2
@@ -278,7 +278,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc,* use simple_strtoul because we need &end and * we know we got non numeric char at the end */ - bid =simple_strtoul (rest, &endp,16 ); + bid =hextoul (rest, &endp);/* BoardId and HWkey are separated with a "_" */ if (*endp =='_' ) { rest = endp +1 ;
@@ -286,7 +286,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc,* use simple_strtoul because we need * &end */ - hwkey =simple_strtoul (rest, &endp,16 ); + hwkey =hextoul (rest, &endp); rest = endp;while (*rest && !isxdigit (*rest)) rest++;
board/kontron/sl28/cmds.c +1 -1
@@ -138,7 +138,7 @@ static int do_sl28_nvm(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_FAILURE ;if (argc >1 ) { - nvm =simple_strtoul (argv[1 ], &endp,16 ); + nvm =hextoul (argv[1 ], &endp);if (*endp !='\0' ) {printf ("ERROR: argument is not a valid number\n" ); ret = -EINVAL ;
board/menlo/m53menlo/m53menlo.c +1 -1
@@ -347,7 +347,7 @@ int board_late_init(void)if (!s)return 0 ; - addr =simple_strtoul (s,NULL ,16 ); + addr =hextoul (s,NULL ); dst =malloc (CONFIG_SYS_VIDEO_LOGO_MAX_SIZE );if (!dst)return -ENOMEM ;
board/renesas/stout/cpld.c +2 -2
@@ -133,7 +133,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[2 ],NULL );if (!(addr ==CPLD_ADDR_VERSION || addr ==CPLD_ADDR_MODE || addr ==CPLD_ADDR_MUX || addr ==CPLD_ADDR_HDMI || addr ==CPLD_ADDR_DIPSW || addr ==CPLD_ADDR_RESET )) {
@@ -144,7 +144,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,if (argc ==3 &&strcmp (argv[1 ],"read" ) ==0 ) {printf ("0x%x\n" ,cpld_read (addr)); }else if (argc ==4 &&strcmp (argv[1 ],"write" ) ==0 ) { - val =simple_strtoul (argv[3 ],NULL ,16 ); + val =hextoul (argv[3 ],NULL );if (addr ==CPLD_ADDR_MUX ) {/* never mask SCIFA0 console */ val &= ~MUX_MSK_SCIFA0_USB ;
board/renesas/ulcb/cpld.c +2 -2
@@ -111,7 +111,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[2 ],NULL );if (!(addr ==CPLD_ADDR_VERSION || addr ==CPLD_ADDR_MODE || addr ==CPLD_ADDR_MUX || addr ==CPLD_ADDR_DIPSW6 || addr ==CPLD_ADDR_RESET )) {
@@ -122,7 +122,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,if (argc ==3 &&strcmp (argv[1 ],"read" ) ==0 ) {printf ("0x%x\n" ,cpld_read (dev, addr)); }else if (argc ==4 &&strcmp (argv[1 ],"write" ) ==0 ) { - val =simple_strtoul (argv[3 ],NULL ,16 ); + val =hextoul (argv[3 ],NULL );cpld_write (dev, addr, val); }
board/siemens/common/factoryset.c +5 -9
@@ -243,7 +243,7 @@ int factoryset_read_eeprom(int i2c_addr) buf, MAX_STRING_LENGTH); cp1 = buf;for (i =0 ; i <6 ; i++) { - factory_dat.mac[i] =simple_strtoul ((char *)cp1,NULL ,16 ); + factory_dat.mac[i] =hextoul ((char *)cp1,NULL ); cp1 +=3 ; }
@@ -254,8 +254,7 @@ int factoryset_read_eeprom(int i2c_addr)if (ret >0 ) { cp1 = buf;for (i =0 ; i <6 ; i++) { - factory_dat.mac_wlan[i] =simple_strtoul ((char *)cp1, -NULL ,16 ); + factory_dat.mac_wlan[i] =hextoul ((char *)cp1,NULL ); cp1 +=3 ; } }
@@ -266,15 +265,13 @@ int factoryset_read_eeprom(int i2c_addr)if (0 <=get_factory_record_val (cp, size, (uchar *)"USBD1" , (uchar *)"vid" , buf,MAX_STRING_LENGTH )) { - factory_dat.usb_vendor_id =simple_strtoul ((char *)buf, -NULL ,16 ); + factory_dat.usb_vendor_id =hextoul ((char *)buf,NULL ); }if (0 <=get_factory_record_val (cp, size, (uchar *)"USBD1" , (uchar *)"pid" , buf,MAX_STRING_LENGTH )) { - factory_dat.usb_product_id =simple_strtoul ((char *)buf, -NULL ,16 ); + factory_dat.usb_product_id =hextoul ((char *)buf,NULL ); }printf ("DFU USB: VID = 0x%4x, PID = 0x%4x\n" , factory_dat.usb_vendor_id, factory_dat.usb_product_id);
@@ -294,8 +291,7 @@ int factoryset_read_eeprom(int i2c_addr)if (0 <=get_factory_record_val (cp, size, (uchar *)"DEV" , (uchar *)"ver" , buf,MAX_STRING_LENGTH )) { - factory_dat.version =simple_strtoul ((char *)buf, -NULL ,16 ); + factory_dat.version =hextoul ((char *)buf,NULL );debug ("version number: %d\n" , factory_dat.version); }/* Get ASN from factory set if available */
board/sifive/unmatched/hifive-platform-i2c-eeprom.c +1 -1
@@ -281,7 +281,7 @@ static void set_mac_address(char *string) }for (i =0 ; *string && (i <MAC_ADDR_BYTES ); i++) { - e.mac_addr[i] =simple_strtoul (string, &string,16 ); + e.mac_addr[i] =hextoul (string, &string);if (*string ==':' ) string++; }
board/synopsys/hsdk/env-lib.c +1 -1
@@ -252,7 +252,7 @@ static int arg_read_set(const struct env_map_common *map, u32 i, int argc,char *endp = argv[1 ];if (map[i].type ==ENV_HEX ) - map[i].val->val =simple_strtoul (argv[1 ], &endp,16 ); + map[i].val->val =hextoul (argv[1 ], &endp);else map[i].val->val =simple_strtoul (argv[1 ], &endp,10 );
board/ti/am64x/evm.c +1 -1
@@ -120,7 +120,7 @@ static void setup_serial(void)if (env_get ("serial#" ))return ; - board_serial =simple_strtoul (ep->serial, &endp,16 ); + board_serial =hextoul (ep->serial, &endp);if (*endp !='\0' ) {pr_err ("Error: Can't set serial# to %s\n" , ep->serial);return ;
board/ti/j721e/evm.c +1 -1
@@ -199,7 +199,7 @@ static void setup_serial(void)if (env_get ("serial#" ))return ; - board_serial =simple_strtoul (ep->serial, &endp,16 ); + board_serial =hextoul (ep->serial, &endp);if (*endp !='\0' ) {pr_err ("Error: Can't set serial# to %s\n" , ep->serial);return ;
board/varisys/common/sys_eeprom.c +2 -2
@@ -299,7 +299,7 @@ static void set_mac_address(unsigned int index, const char *string) }for (i =0 ; *p && (i <6 ); i++) { - e.mac[index][i] =simple_strtoul (p, &p,16 ); + e.mac[index][i] =hextoul (p, &p);if (*p ==':' ) p++; }
@@ -364,7 +364,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])set_date (argv[2 ]);break ;case 'p' :/* MAC table size */ - e.mac_count =simple_strtoul (argv[2 ],NULL ,16 ); + e.mac_count =hextoul (argv[2 ],NULL );update_crc ();break ; case '0' ... '9': /* "mac 0" through "mac 22" */
board/xilinx/common/fru.c +2 -2
@@ -19,7 +19,7 @@ static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,if (argc < cmdtp->maxargs)return CMD_RET_USAGE ; - addr =simple_strtoul (argv[2 ], &endp,16 ); + addr =hextoul (argv[2 ], &endp);if (*argv[1 ] ==0 || *endp !=0 )return -1 ;
@@ -41,7 +41,7 @@ static int do_fru_generate(struct cmd_tbl *cmdtp, int flag, int argc,if (argc < cmdtp->maxargs)return CMD_RET_USAGE ; - addr =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[2 ],NULL );return fru_generate (addr, argv[3 ], argv[4 ], argv[5 ], argv[6 ], argv[7 ]); }
board/xilinx/versal/cmds.c +1 -1
@@ -32,7 +32,7 @@ static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } - len =simple_strtoul (argv[3 ],NULL ,16 ); + len =hextoul (argv[3 ],NULL );if (!len) {debug ("pdi_load: zero size\n" );return CMD_RET_USAGE ;
board/xilinx/zynq/cmds.c +7 -7
@@ -422,7 +422,7 @@ static int do_zynq_rsa(struct cmd_tbl *cmdtp, int flag, int argc,if (argc != cmdtp->maxargs)return CMD_RET_FAILURE ; - src_ptr =simple_strtoul (argv[2 ], &endp,16 ); + src_ptr =hextoul (argv[2 ], &endp);if (*argv[2 ] ==0 || *endp !=0 )return CMD_RET_USAGE ;
@@ -453,26 +453,26 @@ static int zynq_decrypt_image(struct cmd_tbl *cmdtp, int flag, int argc,else return CMD_RET_USAGE ; - srcaddr =simple_strtoul (argv[3 ], &endp,16 ); + srcaddr =hextoul (argv[3 ], &endp);if (*argv[3 ] ==0 || *endp !=0 )return CMD_RET_USAGE ; - srclen =simple_strtoul (argv[4 ], &endp,16 ); + srclen =hextoul (argv[4 ], &endp);if (*argv[4 ] ==0 || *endp !=0 )return CMD_RET_USAGE ; dstaddr =0xFFFFFFFF ; dstlen = srclen; }else { - srcaddr =simple_strtoul (argv[2 ], &endp,16 ); + srcaddr =hextoul (argv[2 ], &endp);if (*argv[2 ] ==0 || *endp !=0 )return CMD_RET_USAGE ; - srclen =simple_strtoul (argv[3 ], &endp,16 ); + srclen =hextoul (argv[3 ], &endp);if (*argv[3 ] ==0 || *endp !=0 )return CMD_RET_USAGE ; - dstaddr =simple_strtoul (argv[4 ], &endp,16 ); + dstaddr =hextoul (argv[4 ], &endp);if (*argv[4 ] ==0 || *endp !=0 )return CMD_RET_USAGE ; - dstlen =simple_strtoul (argv[5 ], &endp,16 ); + dstlen =hextoul (argv[5 ], &endp);if (*argv[5 ] ==0 || *endp !=0 )return CMD_RET_USAGE ; }
board/xilinx/zynqmp/cmds.c +23 -23
107 lines not on this page · raw message
cmd/abootimg.c +1 -1
@@ -161,7 +161,7 @@ static int do_abootimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=2 )return CMD_RET_USAGE ; - img_addr =simple_strtoul (argv[1 ], &endp,16 ); + img_addr =hextoul (argv[1 ], &endp);if (*endp !='\0' ) {printf ("Error: Wrong image address\n" );return CMD_RET_FAILURE ;
cmd/adtimg.c +1 -1
@@ -27,7 +27,7 @@ static int do_adtimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=2 )return CMD_RET_USAGE ; - hdr_addr =simple_strtoul (argv[1 ], &endp,16 ); + hdr_addr =hextoul (argv[1 ], &endp);if (*endp !='\0' ) {printf ("Error: Wrong image address '%s'\n" , argv[1 ]);return CMD_RET_FAILURE ;
cmd/aes.c +5 -5
@@ -55,11 +55,11 @@ static int do_aes(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])else return CMD_RET_USAGE ; - key_addr =simple_strtoul (argv[2 ],NULL ,16 ); - iv_addr =simple_strtoul (argv[3 ],NULL ,16 ); - src_addr =simple_strtoul (argv[4 ],NULL ,16 ); - dst_addr =simple_strtoul (argv[5 ],NULL ,16 ); - len =simple_strtoul (argv[6 ],NULL ,16 ); + key_addr =hextoul (argv[2 ],NULL ); + iv_addr =hextoul (argv[3 ],NULL ); + src_addr =hextoul (argv[4 ],NULL ); + dst_addr =hextoul (argv[5 ],NULL ); + len =hextoul (argv[6 ],NULL ); key_ptr = (uint8_t *)map_sysmem (key_addr, key_len); iv_ptr = (uint8_t *)map_sysmem (iv_addr,128 /8 );
cmd/armflash.c +1 -1
@@ -280,7 +280,7 @@ static int do_afs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }else if (argc ==4 && !strcmp (argv[1 ],"load" )) {ulong load_addr; - load_addr =simple_strtoul (argv[3 ],NULL ,16 ); + load_addr =hextoul (argv[3 ],NULL ); ret =load_image (argv[2 ], load_addr); }else {return CMD_RET_USAGE ;
cmd/avb.c +12 -12
@@ -22,7 +22,7 @@ int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc !=2 )return CMD_RET_USAGE ; - mmc_dev =simple_strtoul (argv[1 ],NULL ,16 ); + mmc_dev =hextoul (argv[1 ],NULL );if (avb_ops)avb_ops_free (avb_ops);
@@ -53,9 +53,9 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; part = argv[1 ]; - offset =simple_strtoul (argv[2 ],NULL ,16 ); - bytes =simple_strtoul (argv[3 ],NULL ,16 ); - buffer = (void *)simple_strtoul (argv[4 ],NULL ,16 ); + offset =hextoul (argv[2 ],NULL ); + bytes =hextoul (argv[3 ],NULL ); + buffer = (void *)hextoul (argv[4 ],NULL ); if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, buffer, &bytes_read) ==
@@ -86,8 +86,8 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; part = argv[1 ]; - offset =simple_strtoul (argv[2 ],NULL ,16 ); - bytes =simple_strtoul (argv[3 ],NULL ,16 ); + offset =hextoul (argv[2 ],NULL ); + bytes =hextoul (argv[3 ],NULL ); buffer =malloc (bytes);if (!buffer) {
@@ -132,9 +132,9 @@ int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; part = argv[1 ]; - offset =simple_strtoul (argv[2 ],NULL ,16 ); - bytes =simple_strtoul (argv[3 ],NULL ,16 ); - buffer = (void *)simple_strtoul (argv[4 ],NULL ,16 ); + offset =hextoul (argv[2 ],NULL ); + bytes =hextoul (argv[3 ],NULL ); + buffer = (void *)hextoul (argv[4 ],NULL );if (avb_ops->write_to_partition (avb_ops, part, offset, bytes, buffer) ==AVB_IO_RESULT_OK ) {
@@ -161,7 +161,7 @@ int do_avb_read_rb(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=2 )return CMD_RET_USAGE ; - index = (size_t )simple_strtoul (argv[1 ],NULL ,16 ); + index = (size_t )hextoul (argv[1 ],NULL );if (avb_ops->read_rollback_index (avb_ops, index, &rb_idx) ==AVB_IO_RESULT_OK ) {
@@ -188,8 +188,8 @@ int do_avb_write_rb(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=3 )return CMD_RET_USAGE ; - index = (size_t )simple_strtoul (argv[1 ],NULL ,16 ); - rb_idx =simple_strtoul (argv[2 ],NULL ,16 ); + index = (size_t )hextoul (argv[1 ],NULL ); + rb_idx =hextoul (argv[2 ],NULL );if (avb_ops->write_rollback_index (avb_ops, index, rb_idx) ==AVB_IO_RESULT_OK )
cmd/axi.c +5 -5
@@ -198,14 +198,14 @@ static int do_axi_md(struct cmd_tbl *cmdtp, int flag, int argc,/* * Address is specified since argc >= 3 */ - addr =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[2 ],NULL );/* * If there's another parameter, it is the length to display; * length is the number of objects, not number of bytes */ if (argc >3 ) - length =simple_strtoul (argv[3 ],NULL ,16 ); + length =hextoul (argv[3 ],NULL ); }switch (size) {
@@ -291,14 +291,14 @@ static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc, };/* Address is specified since argc > 4 */ - addr =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[2 ],NULL );/* Get the value to write */ - writeval =simple_strtoul (argv[3 ],NULL ,16 ); + writeval =hextoul (argv[3 ],NULL );/* Count ? */ if (argc ==5 ) - count =simple_strtoul (argv[4 ],NULL ,16 ); + count =hextoul (argv[4 ],NULL );else count =1 ;
cmd/bedbug.c +3 -3
@@ -75,11 +75,11 @@ int do_bedbug_dis(struct cmd_tbl *cmdtp, int flag, int argc,if ((flag &CMD_FLAG_REPEAT ) ==0 ) {/* New command */ - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );/* If an extra param is given then it is the length */ if (argc >2 ) - len =simple_strtoul (argv[2 ],NULL ,16 ); + len =hextoul (argv[2 ],NULL ); }/* Run the disassembler */
@@ -114,7 +114,7 @@ int do_bedbug_asm(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ;printf ("\nEnter '.' when done\n" ); - mem_addr =simple_strtoul (argv[1 ],NULL ,16 ); + mem_addr =hextoul (argv[1 ],NULL );while (1 ) {putc ('\n' );
cmd/binop.c +3 -3
@@ -58,7 +58,7 @@ void write_to_mem(char *varname, u8 *result, ulong len)ulong addr;u8 *buf; - addr =simple_strtoul (varname,NULL ,16 ); + addr =hextoul (varname,NULL ); buf =map_sysmem (addr, len);memcpy (buf, result, len);unmap_sysmem (buf);
@@ -95,12 +95,12 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc, src2 =malloc (len);if (*src1arg =='*' ) -read_from_mem (simple_strtoul (src1arg +1 ,NULL ,16 ), src1, len); +read_from_mem (hextoul (src1arg +1 ,NULL ), src1, len);else read_from_env_var (src1arg, src1);if (*src2arg =='*' ) -read_from_mem (simple_strtoul (src2arg +1 ,NULL ,16 ), src2, len); +read_from_mem (hextoul (src2arg +1 ,NULL ), src2, len);else read_from_env_var (src2arg, src2);
cmd/blk_common.c +6 -6
@@ -63,9 +63,9 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,default :/* at least 4 args */ if (strcmp (argv[1 ],"read" ) ==0 ) { -ulong addr =simple_strtoul (argv[2 ],NULL ,16 ); -lbaint_t blk =simple_strtoul (argv[3 ],NULL ,16 ); -ulong cnt =simple_strtoul (argv[4 ],NULL ,16 ); +ulong addr =hextoul (argv[2 ],NULL ); +lbaint_t blk =hextoul (argv[3 ],NULL ); +ulong cnt =hextoul (argv[4 ],NULL );ulong n; printf("\n%s read: device %d block # "LBAFU", count %lu ... ",
@@ -78,9 +78,9 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type, n == cnt ? "OK" : "ERROR");return n == cnt ?0 :1 ; }else if (strcmp (argv[1 ],"write" ) ==0 ) { -ulong addr =simple_strtoul (argv[2 ],NULL ,16 ); -lbaint_t blk =simple_strtoul (argv[3 ],NULL ,16 ); -ulong cnt =simple_strtoul (argv[4 ],NULL ,16 ); +ulong addr =hextoul (argv[2 ],NULL ); +lbaint_t blk =hextoul (argv[3 ],NULL ); +ulong cnt =hextoul (argv[4 ],NULL );ulong n; printf("\n%s write: device %d block # "LBAFU", count %lu ... ",
cmd/blob.c +4 -4
@@ -70,10 +70,10 @@ static int do_blob(struct cmd_tbl *cmdtp, int flag, int argc,else return CMD_RET_USAGE ; - src_addr =simple_strtoul (argv[2 ],NULL ,16 ); - dst_addr =simple_strtoul (argv[3 ],NULL ,16 ); - len =simple_strtoul (argv[4 ],NULL ,16 ); - key_addr =simple_strtoul (argv[5 ],NULL ,16 ); + src_addr =hextoul (argv[2 ],NULL ); + dst_addr =hextoul (argv[3 ],NULL ); + len =hextoul (argv[4 ],NULL ); + key_addr =hextoul (argv[5 ],NULL ); km_ptr = (uint8_t *)(uintptr_t )key_addr; src_ptr = (uint8_t *)(uintptr_t )src_addr;
cmd/bmp.c +3 -3
@@ -102,7 +102,7 @@ static int do_bmp_info(struct cmd_tbl *cmdtp, int flag, int argc, addr = image_load_addr;break ;case 2 :/* use argument */ - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );break ;default :return CMD_RET_USAGE ;
@@ -124,10 +124,10 @@ static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc, addr = image_load_addr;break ;case 2 :/* use argument */ - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );break ;case 4 : - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );if (!strcmp (argv[2 ],"m" )) x =BMP_ALIGN_CENTER ;else
cmd/boot.c +1 -1
@@ -29,7 +29,7 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc <2 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );printf ("## Starting application at 0x%08lX ...\n" , addr);
cmd/bootefi.c +2 -2
@@ -281,7 +281,7 @@ efi_status_t efi_install_fdt(void *fdt)return EFI_NOT_FOUND ; } } - fdt_addr =simple_strtoul (fdt_opt,NULL ,16 ); + fdt_addr =hextoul (fdt_opt,NULL );if (!fdt_addr) {log_err ("ERROR: invalid $fdt_addr or $fdtcontroladdr\n" );return EFI_LOAD_ERROR ;
@@ -628,7 +628,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,if (argc >2 ) {uintptr_t fdt_addr; - fdt_addr =simple_strtoul (argv[2 ],NULL ,16 ); + fdt_addr =hextoul (argv[2 ],NULL ); fdt =map_sysmem (fdt_addr,0 ); }else { fdt =EFI_FDT_USE_INTERNAL ;
cmd/booti.c +1 -1
@@ -43,7 +43,7 @@ static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc,debug ("* kernel: default image load address = 0x%08lx\n" , image_load_addr); }else { - ld =simple_strtoul (argv[0 ],NULL ,16 ); + ld =hextoul (argv[0 ],NULL );debug ("* kernel: cmdline image address = 0x%08lx\n" , ld); }
cmd/bootm.c +2 -2
@@ -112,7 +112,7 @@ int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc >0 ) {char *endp; -simple_strtoul (argv[0 ], &endp,16 ); +hextoul (argv[0 ], &endp);/* endp pointing to NULL means that argv[0] was just a * valid number, pass it along to the normal bootm processing *
@@ -240,7 +240,7 @@ static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc, }for (arg =1 ; arg < argc; ++arg) { - addr =simple_strtoul (argv[arg],NULL ,16 ); + addr =hextoul (argv[arg],NULL );if (image_info (addr) !=0 ) rcode =1 ; }
cmd/bootstage.c +2 -2
@@ -24,12 +24,12 @@ static int get_base_size(int argc, char *const argv[], ulong *basep, *sizep =CONFIG_BOOTSTAGE_STASH_SIZE ;if (argc <2 )return 0 ; - *basep =simple_strtoul (argv[1 ], &endp,16 ); + *basep =hextoul (argv[1 ], &endp);if (*argv[1 ] ==0 || *endp !=0 )return -1 ;if (argc ==2 )return 0 ; - *sizep =simple_strtoul (argv[2 ], &endp,16 ); + *sizep =hextoul (argv[2 ], &endp);if (*argv[2 ] ==0 || *endp !=0 )return -1 ;
cmd/bootz.c +1 -1
@@ -39,7 +39,7 @@ static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,debug ("* kernel: default image load address = 0x%08lx\n" , image_load_addr); }else { - images->ep =simple_strtoul (argv[0 ],NULL ,16 ); + images->ep =hextoul (argv[0 ],NULL );debug ("* kernel: cmdline image address = 0x%08lx\n" , images->ep); }
cmd/broadcom/nitro_image_load.c +2 -2
@@ -53,13 +53,13 @@ static int do_spi_images_addr(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ;/* convert command parameter to fastboot address (base 16), i.e. hex */ - images_load_addr =simple_strtoul (argv[1 ],NULL ,16 ); + images_load_addr =hextoul (argv[1 ],NULL );if (!images_load_addr) {pr_err ("Invalid load address\n" );return CMD_RET_USAGE ; } - spi_load_addr =simple_strtoul (argv[2 ],NULL ,16 ); + spi_load_addr =hextoul (argv[2 ],NULL );if (!spi_load_addr) {pr_err ("Invalid spi load address\n" );return CMD_RET_USAGE ;
cmd/cbfs.c +3 -3
@@ -22,7 +22,7 @@ static int do_cbfs_init(struct cmd_tbl *cmdtp, int flag, int argc,return 0 ; }if (argc ==2 ) { - end_of_rom =simple_strtoul (argv[1 ], &ep,16 ); + end_of_rom =hextoul (argv[1 ], &ep);if (*ep) {puts ("\n** Invalid end of ROM **\n" );return 1 ;
@@ -58,9 +58,9 @@ static int do_cbfs_fsload(struct cmd_tbl *cmdtp, int flag, int argc, }/* parse offset and count */ - offset =simple_strtoul (argv[1 ],NULL ,16 ); + offset =hextoul (argv[1 ],NULL );if (argc ==4 ) - count =simple_strtoul (argv[3 ],NULL ,16 ); + count =hextoul (argv[3 ],NULL );else count =0 ;
cmd/cramfs.c +2 -2
@@ -107,7 +107,7 @@ int do_cramfs_load(struct cmd_tbl *cmdtp, int flag, int argc,struct mtdids id;ulong addr; - addr =simple_strtoul (env_get ("cramfsaddr" ),NULL ,16 ); + addr =hextoul (env_get ("cramfsaddr" ),NULL );/* hack! */ /* cramfs_* only supports NOR flash chips */
@@ -172,7 +172,7 @@ int do_cramfs_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct mtdids id;ulong addr; - addr =simple_strtoul (env_get ("cramfsaddr" ),NULL ,16 ); + addr =hextoul (env_get ("cramfsaddr" ),NULL );/* hack! */ /* cramfs_* only supports NOR flash chips */
cmd/cros_ec.c +2 -2
@@ -65,11 +65,11 @@ static int do_read_write(struct udevice *dev, int is_write, int argc,return 1 ;if (argc <4 )return 1 ; - addr =simple_strtoul (argv[3 ], &endp,16 ); + addr =hextoul (argv[3 ], &endp);if (*argv[3 ] ==0 || *endp !=0 )return 1 ;if (argc >4 ) { - size =simple_strtoul (argv[4 ], &endp,16 ); + size =hextoul (argv[4 ], &endp);if (*argv[4 ] ==0 || *endp !=0 )return 1 ; }
cmd/demo.c +1 -1
@@ -48,7 +48,7 @@ static int do_demo_light(struct cmd_tbl *cmdtp, int flag, int argc,int ret;if (argc) { - light =simple_strtoul (argv[0 ],NULL ,16 ); + light =hextoul (argv[0 ],NULL ); ret =demo_set_light (demo_dev, light); }else { ret =demo_get_light (demo_dev);
cmd/disk.c +1 -1
@@ -36,7 +36,7 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,bootstage_mark (BOOTSTAGE_ID_IDE_ADDR );if (argc >1 ) - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );bootstage_mark (BOOTSTAGE_ID_IDE_BOOT_DEVICE );
cmd/efidebug.c +7 -7
@@ -61,7 +61,7 @@ static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag, argv++; } - capsule = (typeof (capsule ))simple_strtoul (argv[1 ], &endp,16 ); + capsule = (typeof (capsule ))hextoul (argv[1 ], &endp);if (endp == argv[1 ]) {printf ("Invalid address: %s" , argv[1 ]);return CMD_RET_FAILURE ;
@@ -117,7 +117,7 @@ static int do_efi_capsule_show(struct cmd_tbl *cmdtp, int flag,if (argc !=2 )return CMD_RET_USAGE ; - capsule = (typeof (capsule ))simple_strtoul (argv[1 ], &endp,16 ); + capsule = (typeof (capsule ))hextoul (argv[1 ], &endp);if (endp == argv[1 ]) {printf ("Invalid address: %s" , argv[1 ]);return CMD_RET_FAILURE ;
@@ -256,7 +256,7 @@ static int do_efi_capsule_res(struct cmd_tbl *cmdtp, int flag, argc--; argv++; - capsule_id =simple_strtoul (argv[0 ], &endp,16 ); + capsule_id =hextoul (argv[0 ], &endp);if (capsule_id <0 || capsule_id >0xffff )return CMD_RET_USAGE ;
@@ -983,7 +983,7 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, r =CMD_RET_USAGE ; goto out; } - id = (int )simple_strtoul (argv[1 ], &endp,16 ); + id = (int )hextoul (argv[1 ], &endp);if (*endp !='\0' || id >0xffff )return CMD_RET_USAGE ;
@@ -1113,7 +1113,7 @@ static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag, guid = efi_global_variable_guid;for (i =1 ; i < argc; i++, argv++) { - id = (int )simple_strtoul (argv[1 ], &endp,16 ); + id = (int )hextoul (argv[1 ], &endp);if (*endp !='\0' || id >0xffff )return CMD_RET_FAILURE ;
@@ -1410,7 +1410,7 @@ static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,if (argc !=2 )return CMD_RET_USAGE ; - bootnext = (u16 )simple_strtoul (argv[1 ], &endp,16 ); + bootnext = (u16 )hextoul (argv[1 ], &endp);if (*endp) {printf ("invalid value: %s\n" , argv[1 ]); r =CMD_RET_FAILURE ;
@@ -1469,7 +1469,7 @@ static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,return CMD_RET_FAILURE ;for (i =0 ; i < argc; i++) { - id = (int )simple_strtoul (argv[i], &endp,16 ); + id = (int )hextoul (argv[i], &endp);if (*endp !='\0' || id >0xffff ) {printf ("invalid value: %s\n" , argv[i]); r =CMD_RET_FAILURE ;
cmd/elf.c +2 -2
@@ -115,7 +115,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc <2 ) addr = image_load_addr;else - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );#if defined(CONFIG_CMD_NET )/*
@@ -200,7 +200,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }if (!bootaddr) - bootaddr =simple_strtoul (tmp,NULL ,16 ); + bootaddr =hextoul (tmp,NULL );/* * Check to see if the bootline is defined in the 'bootargs' parameter.
cmd/fastboot.c +2 -2
@@ -112,13 +112,13 @@ static int do_fastboot(struct cmd_tbl *cmdtp, int flag, int argc,case 'l' :if (--argc <=0 )return CMD_RET_USAGE ; - buf_addr =simple_strtoul (*++argv,NULL ,16 ); + buf_addr =hextoul (*++argv,NULL ); goto NXTARG;case 's' :if (--argc <=0 )return CMD_RET_USAGE ; - buf_size =simple_strtoul (*++argv,NULL ,16 ); + buf_size =hextoul (*++argv,NULL ); goto NXTARG;default :
cmd/fdt.c +21 -20
138 lines not on this page · raw message
cmd/flash.c +5 -5
@@ -151,7 +151,7 @@ addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)char *ep;char len_used;/* indicates if the "start +length" form used */ - *addr_first =simple_strtoul (arg1, &ep,16 ); + *addr_first =hextoul (arg1, &ep);if (ep == arg1 || *ep !='\0' )return -1 ;
@@ -161,7 +161,7 @@ addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last) ++arg2; } - *addr_last =simple_strtoul (arg2, &ep,16 ); + *addr_last =hextoul (arg2, &ep);if (ep == arg2 || *ep !='\0' )return -1 ;
@@ -287,7 +287,7 @@ static int do_flinfo(struct cmd_tbl *cmdtp, int flag, int argc,return 0 ; } - bank =simple_strtoul (argv[1 ],NULL ,16 ); + bank =hextoul (argv[1 ],NULL );if ((bank <1 ) || (bank >CONFIG_SYS_MAX_FLASH_BANKS )) {printf ("Only FLASH Banks # 1 ... # %d supported\n" ,CONFIG_SYS_MAX_FLASH_BANKS );
@@ -366,7 +366,7 @@ static int do_flerase(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ;if (strcmp (argv[1 ],"bank" ) ==0 ) { - bank =simple_strtoul (argv[2 ],NULL ,16 ); + bank =hextoul (argv[2 ],NULL );if ((bank <1 ) || (bank >CONFIG_SYS_MAX_FLASH_BANKS )) {printf ("Only FLASH Banks # 1 ... # %d supported\n" ,CONFIG_SYS_MAX_FLASH_BANKS );
@@ -547,7 +547,7 @@ static int do_protect(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ;if (strcmp (argv[2 ],"bank" ) ==0 ) { - bank =simple_strtoul (argv[3 ],NULL ,16 ); + bank =hextoul (argv[3 ],NULL );if ((bank <1 ) || (bank >CONFIG_SYS_MAX_FLASH_BANKS )) {printf ("Only FLASH Banks # 1 ... # %d supported\n" ,CONFIG_SYS_MAX_FLASH_BANKS );
cmd/fpga.c +5 -5
@@ -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); }
cmd/fpgad.c +3 -3
@@ -49,19 +49,19 @@ int do_fpga_md(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])/* * FPGA is specified since argc > 2 */ - fpga =simple_strtoul (argv[1 ],NULL ,16 ); + fpga =hextoul (argv[1 ],NULL );/* * Address is specified since argc > 2 */ - addr =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[2 ],NULL );/* * If another parameter, it is the length to display. * Length is the number of objects, not number of bytes. */ if (argc >3 ) - length =simple_strtoul (argv[3 ],NULL ,16 ); + length =hextoul (argv[3 ],NULL ); } nbytes = length *sizeof (u16);
cmd/host.c +3 -3
@@ -62,7 +62,7 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,if (argc >2 )return CMD_RET_USAGE ; dev_str = argv[0 ]; - dev =simple_strtoul (dev_str, &ep,16 ); + dev =hextoul (dev_str, &ep);if (*ep) {printf ("** Bad device specification %s **\n" , dev_str);return CMD_RET_USAGE ;
@@ -82,7 +82,7 @@ static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,if (argc >=2 ) {char *ep;char *dev_str = argv[1 ]; -int dev =simple_strtoul (dev_str, &ep,16 ); +int dev =hextoul (dev_str, &ep);if (*ep) {printf ("** Bad device specification %s **\n" , dev_str);return CMD_RET_USAGE ;
@@ -139,7 +139,7 @@ static int do_host_dev(struct cmd_tbl *cmdtp, int flag, int argc,return 0 ; } - dev =simple_strtoul (argv[1 ], &ep,16 ); + dev =hextoul (argv[1 ], &ep);if (*ep) {printf ("** Bad device specification %s **\n" , argv[2 ]);return CMD_RET_USAGE ;
cmd/i2c.c +30 -30
222 lines not on this page · raw message
cmd/ini.c +4 -4
@@ -236,10 +236,10 @@ static int do_ini(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return CMD_RET_USAGE ; section = argv[1 ]; - file_address = (char *)simple_strtoul ( - argc <3 ?env_get ("loadaddr" ) : argv[2 ],NULL ,16 ); - file_size = (size_t )simple_strtoul ( - argc <4 ?env_get ("filesize" ) : argv[3 ],NULL ,16 ); + file_address = (char *)hextoul (argc <3 ?env_get ("loadaddr" ) : argv[2 ], +NULL ); + file_size = (size_t )hextoul (argc <4 ?env_get ("filesize" ) : argv[3 ], +NULL );return ini_parse (file_address, file_size, ini_handler, (void *)section); }
cmd/io.c +4 -4
@@ -51,7 +51,7 @@ int do_io_iod(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ;/* Address is specified since argc > 1 */ - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); addr += base_address;/*
@@ -59,7 +59,7 @@ int do_io_iod(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])* Length is the number of objects, not number of bytes. */ if (argc >2 ) - length =simple_strtoul (argv[2 ],NULL ,16 ); + length =hextoul (argv[2 ],NULL ); } bytes = size * length;
@@ -102,8 +102,8 @@ int do_io_iow(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (size <0 )return 1 ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); - val =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); + val =hextoul (argv[2 ],NULL );if (size ==4 )outl ((u32 ) val, addr);
cmd/iotrace.c +4 -4
@@ -60,8 +60,8 @@ static int do_set_buffer(int argc, char *const argv[])ulong addr =0 , size =0 ;if (argc ==2 ) { - addr =simple_strtoul (*argv++,NULL ,16 ); - size =simple_strtoul (*argv++,NULL ,16 ); + addr =hextoul (*argv++,NULL ); + size =hextoul (*argv++,NULL ); }else if (argc !=0 ) {return CMD_RET_USAGE ; }
@@ -76,8 +76,8 @@ static int do_set_region(int argc, char *const argv[])ulong addr =0 , size =0 ;if (argc ==2 ) { - addr =simple_strtoul (*argv++,NULL ,16 ); - size =simple_strtoul (*argv++,NULL ,16 ); + addr =hextoul (*argv++,NULL ); + size =hextoul (*argv++,NULL ); }else if (argc !=0 ) {return CMD_RET_USAGE ; }
cmd/itest.c +3 -3
@@ -57,7 +57,7 @@ static long evalexp(char *s, int w)/* if the parameter starts with a * then assume is a pointer to the value we want */ if (s[0 ] =='*' ) { - addr =simple_strtoul (&s[1 ],NULL ,16 ); + addr =hextoul (&s[1 ],NULL ); buf =map_physmem (addr, w,MAP_WRBACK );if (!buf && addr) {puts ("Failed to map physical memory\n" );
@@ -82,7 +82,7 @@ static long evalexp(char *s, int w)unmap_physmem (buf, w);return l; }else { - l =simple_strtoul (s,NULL ,16 ); + l =hextoul (s,NULL ); }/* avoid overflow on mask calculus */
@@ -93,7 +93,7 @@ static char * evalstr(char *s) {/* if the parameter starts with a * then assume a string pointer else its a literal */ if (s[0 ] =='*' ) { -return (char *)simple_strtoul (&s[1 ],NULL ,16 ); +return (char *)hextoul (&s[1 ],NULL ); }else if (s[0 ] =='$' ) {int i =2 ;
cmd/jffs2.c +1 -1
@@ -491,7 +491,7 @@ int do_jffs2_fsload(struct cmd_tbl *cmdtp, int flag, int argc, filename = argv[1 ]; }if (argc ==3 ) { - offset =simple_strtoul (argv[1 ],NULL ,16 ); + offset =hextoul (argv[1 ],NULL ); image_load_addr = offset; filename = argv[2 ]; }
cmd/load.c +5 -5
@@ -257,11 +257,11 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,#endif if (argc >=2 ) { - offset =simple_strtoul (argv[1 ],NULL ,16 ); + offset =hextoul (argv[1 ],NULL ); }#ifdef CONFIG_SYS_LOADS_BAUD_CHANGE if (argc >=3 ) { - size =simple_strtoul (argv[2 ],NULL ,16 ); + size =hextoul (argv[2 ],NULL ); }if (argc ==4 ) { save_baudrate = (int )simple_strtoul (argv[3 ],NULL ,10 );
@@ -284,7 +284,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc, }#else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */ if (argc ==3 ) { - size =simple_strtoul (argv[2 ],NULL ,16 ); + size =hextoul (argv[2 ],NULL ); }#endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
@@ -438,12 +438,12 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,/* pre-set offset from $loadaddr */ s =env_get ("loadaddr" );if (s) - offset =simple_strtoul (s,NULL ,16 ); + offset =hextoul (s,NULL ); load_baudrate = current_baudrate = gd->baudrate;if (argc >=2 ) { - offset =simple_strtoul (argv[1 ],NULL ,16 ); + offset =hextoul (argv[1 ],NULL ); }if (argc ==3 ) { load_baudrate = (int )simple_strtoul (argv[2 ],NULL ,10 );
cmd/lzmadec.c +3 -3
@@ -26,11 +26,11 @@ static int do_lzmadec(struct cmd_tbl *cmdtp, int flag, int argc,switch (argc) {case 4 : - dst_len =simple_strtoul (argv[3 ],NULL ,16 ); + dst_len =hextoul (argv[3 ],NULL );/* fall through */ case 3 : - src =simple_strtoul (argv[1 ],NULL ,16 ); - dst =simple_strtoul (argv[2 ],NULL ,16 ); + src =hextoul (argv[1 ],NULL ); + dst =hextoul (argv[2 ],NULL );break ;default :return CMD_RET_USAGE ;
cmd/md5sum.c +7 -7
@@ -25,7 +25,7 @@ static void store_result(const u8 *sum, const char *dest)if (*dest =='*' ) {u8 *ptr; - ptr = (u8 *)simple_strtoul (dest +1 ,NULL ,16 ); + ptr = (u8 *)hextoul (dest +1 ,NULL );for (i =0 ; i <16 ; i++) *ptr++ = sum[i]; }else {
@@ -46,7 +46,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)if (*verify_str =='*' ) {u8 *ptr; - ptr = (u8 *)simple_strtoul (verify_str +1 ,NULL ,16 ); + ptr = (u8 *)hextoul (verify_str +1 ,NULL );memcpy (vsum, ptr,16 ); }else {unsigned int i;
@@ -66,7 +66,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum) *nullp ='\0' ; *(u8 *)(vsum + i) = -simple_strtoul (vsum_str + (i *2 ),NULL ,16 ); +hextoul (vsum_str + (i *2 ),NULL ); *nullp = end; } }
@@ -97,8 +97,8 @@ int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return CMD_RET_USAGE ; } - addr =simple_strtoul (*av++,NULL ,16 ); - len =simple_strtoul (*av++,NULL ,16 ); + addr =hextoul (*av++,NULL ); + len =hextoul (*av++,NULL ); buf =map_sysmem (addr, len);md5_wd (buf, len, output,CHUNKSZ_MD5 );
@@ -147,8 +147,8 @@ static int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); - len =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); + len =hextoul (argv[2 ],NULL ); buf =map_sysmem (addr, len);md5_wd (buf, len, output,CHUNKSZ_MD5 );
cmd/mdio.c +1 -1
@@ -254,7 +254,7 @@ static int do_mdio(struct cmd_tbl *cmdtp, int flag, int argc,switch (op[0 ]) {case 'w' :if (pos >1 ) - data =simple_strtoul (argv[pos--],NULL ,16 ); + data =hextoul (argv[pos--],NULL );/* Intentional fall-through - Get reg for read and write */ case 'r' :if (pos >1 )
cmd/mem.c +26 -26
169 lines not on this page · raw message
cmd/mfsl.c +7 -7
@@ -23,8 +23,8 @@ int do_frd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc <2 )return CMD_RET_USAGE ; - fslnum = (unsigned int )simple_strtoul (argv[1 ],NULL ,16 ); - blocking = (unsigned int )simple_strtoul (argv[2 ],NULL ,16 ); + fslnum = (unsigned int )hextoul (argv[1 ],NULL ); + blocking = (unsigned int )hextoul (argv[2 ],NULL );if (fslnum <0 || fslnum >=XILINX_FSL_NUMBER ) {puts ("Bad number of FSL\n" );return CMD_RET_USAGE ;
@@ -178,9 +178,9 @@ int do_fwr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc <3 )return CMD_RET_USAGE ; - fslnum = (unsigned int )simple_strtoul (argv[1 ],NULL ,16 ); - num = (unsigned int )simple_strtoul (argv[2 ],NULL ,16 ); - blocking = (unsigned int )simple_strtoul (argv[3 ],NULL ,16 ); + fslnum = (unsigned int )hextoul (argv[1 ],NULL ); + num = (unsigned int )hextoul (argv[2 ],NULL ); + blocking = (unsigned int )hextoul (argv[3 ],NULL );if (fslnum <0 || fslnum >=XILINX_FSL_NUMBER )return CMD_RET_USAGE ;
@@ -332,8 +332,8 @@ int do_rspr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc <2 )return CMD_RET_USAGE ; - reg = (unsigned int )simple_strtoul (argv[1 ],NULL ,16 ); - val = (unsigned int )simple_strtoul (argv[2 ],NULL ,16 ); + reg = (unsigned int )hextoul (argv[1 ],NULL ); + val = (unsigned int )hextoul (argv[2 ],NULL );switch (reg) {case 0x1 :if (argc >2 ) {
cmd/mii.c +4 -4
@@ -267,10 +267,10 @@ static void extract_range( unsigned char * phi) {char * end; - *plo =simple_strtoul (input, &end,16 ); + *plo =hextoul (input, &end);if (*end =='-' ) { end++; - *phi =simple_strtoul (end,NULL ,16 ); + *phi =hextoul (end,NULL ); }else { *phi = *plo;
@@ -319,9 +319,9 @@ static int do_mii(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc >=4 )extract_range (argv[3 ], ®lo, ®hi);if (argc >=5 ) - data =simple_strtoul (argv[4 ],NULL ,16 ); + data =hextoul (argv[4 ],NULL );if (argc >=6 ) - mask =simple_strtoul (argv[5 ],NULL ,16 ); + mask =hextoul (argv[5 ],NULL ); }if (addrhi >31 &&strncmp (op,"de" ,2 )) {
cmd/misc.c +3 -3
@@ -57,9 +57,9 @@ static int do_misc_op(struct cmd_tbl *cmdtp, int flag,return ret; } - offset =simple_strtoul (argv[1 ],NULL ,16 ); - buf = (void *)simple_strtoul (argv[2 ],NULL ,16 ); - size =simple_strtoul (argv[3 ],NULL ,16 ); + offset =hextoul (argv[1 ],NULL ); + buf = (void *)hextoul (argv[2 ],NULL ); + size =hextoul (argv[3 ],NULL );if (op ==MISC_OP_READ ) misc_op = misc_read;
cmd/mmc.c +20 -20
@@ -189,7 +189,7 @@ static int do_mmcrpmb_key(struct cmd_tbl *cmdtp, int flag,if (argc !=2 )return CMD_RET_USAGE ; - key_addr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); + key_addr = (void *)hextoul (argv[1 ],NULL );if (!confirm_key_prog ())return CMD_RET_FAILURE ;if (mmc_rpmb_set_key (mmc, key_addr)) {
@@ -211,12 +211,12 @@ static int do_mmcrpmb_read(struct cmd_tbl *cmdtp, int flag,if (argc <4 )return CMD_RET_USAGE ; - addr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); - blk =simple_strtoul (argv[2 ],NULL ,16 ); - cnt =simple_strtoul (argv[3 ],NULL ,16 ); + addr = (void *)hextoul (argv[1 ],NULL ); + blk =hextoul (argv[2 ],NULL ); + cnt =hextoul (argv[3 ],NULL );if (argc ==5 ) - key_addr = (void *)simple_strtoul (argv[4 ],NULL ,16 ); + key_addr = (void *)hextoul (argv[4 ],NULL );printf ("\nMMC RPMB read: dev # %d, block # %d, count %d ... " , curr_device, blk, cnt);
@@ -240,10 +240,10 @@ static int do_mmcrpmb_write(struct cmd_tbl *cmdtp, int flag,if (argc !=5 )return CMD_RET_USAGE ; - addr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); - blk =simple_strtoul (argv[2 ],NULL ,16 ); - cnt =simple_strtoul (argv[3 ],NULL ,16 ); - key_addr = (void *)simple_strtoul (argv[4 ],NULL ,16 ); + addr = (void *)hextoul (argv[1 ],NULL ); + blk =hextoul (argv[2 ],NULL ); + cnt =hextoul (argv[3 ],NULL ); + key_addr = (void *)hextoul (argv[4 ],NULL );printf ("\nMMC RPMB write: dev # %d, block # %d, count %d ... " , curr_device, blk, cnt);
@@ -334,9 +334,9 @@ static int do_mmc_read(struct cmd_tbl *cmdtp, int flag,if (argc !=4 )return CMD_RET_USAGE ; - addr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); - blk =simple_strtoul (argv[2 ],NULL ,16 ); - cnt =simple_strtoul (argv[3 ],NULL ,16 ); + addr = (void *)hextoul (argv[1 ],NULL ); + blk =hextoul (argv[2 ],NULL ); + cnt =hextoul (argv[3 ],NULL ); mmc =init_mmc_device (curr_device, false);if (!mmc)
@@ -379,8 +379,8 @@ static int do_mmc_sparse_write(struct cmd_tbl *cmdtp, int flag,if (argc !=3 )return CMD_RET_USAGE ; - addr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); - blk =simple_strtoul (argv[2 ],NULL ,16 ); + addr = (void *)hextoul (argv[1 ],NULL ); + blk =hextoul (argv[2 ],NULL );if (!is_sparse_image (addr)) {printf ("Not a sparse image\n" );
@@ -427,9 +427,9 @@ static int do_mmc_write(struct cmd_tbl *cmdtp, int flag,if (argc !=4 )return CMD_RET_USAGE ; - addr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); - blk =simple_strtoul (argv[2 ],NULL ,16 ); - cnt =simple_strtoul (argv[3 ],NULL ,16 ); + addr = (void *)hextoul (argv[1 ],NULL ); + blk =hextoul (argv[2 ],NULL ); + cnt =hextoul (argv[3 ],NULL ); mmc =init_mmc_device (curr_device, false);if (!mmc)
@@ -457,8 +457,8 @@ static int do_mmc_erase(struct cmd_tbl *cmdtp, int flag,if (argc !=3 )return CMD_RET_USAGE ; - blk =simple_strtoul (argv[1 ],NULL ,16 ); - cnt =simple_strtoul (argv[2 ],NULL ,16 ); + blk =hextoul (argv[1 ],NULL ); + cnt =hextoul (argv[2 ],NULL ); mmc =init_mmc_device (curr_device, false);if (!mmc)
@@ -908,7 +908,7 @@ static int do_mmc_setdsr(struct cmd_tbl *cmdtp, int flag,if (argc !=2 )return CMD_RET_USAGE ; - val =simple_strtoul (argv[1 ],NULL ,16 ); + val =hextoul (argv[1 ],NULL ); mmc =find_mmc_device (curr_device);if (!mmc) {
cmd/mtd.c +5 -5
@@ -285,12 +285,12 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, goto out_put_mtd; } - user_addr =simple_strtoul (argv[0 ],NULL ,16 ); + user_addr =hextoul (argv[0 ],NULL ); argc--; argv++; } - start_off = argc >0 ?simple_strtoul (argv[0 ],NULL ,16 ) :0 ; + start_off = argc >0 ?hextoul (argv[0 ],NULL ) :0 ;if (!mtd_is_aligned_with_min_io_size (mtd, start_off)) {printf ("Offset not aligned with a page (0x%x)\n" , mtd->writesize);
@@ -299,7 +299,7 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, } default_len = dump ? mtd->writesize : mtd->size; - len = argc >1 ?simple_strtoul (argv[1 ],NULL ,16 ) : default_len; + len = argc >1 ?hextoul (argv[1 ],NULL ) : default_len;if (!mtd_is_aligned_with_min_io_size (mtd, len)) { len =round_up (len, mtd->writesize); printf("Size not on a page boundary (0x%x), rounding to 0x%llx\n",
@@ -411,8 +411,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, argc -=2 ; argv +=2 ; - off = argc >0 ?simple_strtoul (argv[0 ],NULL ,16 ) :0 ; - len = argc >1 ?simple_strtoul (argv[1 ],NULL ,16 ) : mtd->size; + off = argc >0 ?hextoul (argv[0 ],NULL ) :0 ; + len = argc >1 ?hextoul (argv[1 ],NULL ) : mtd->size;if (!mtd_is_aligned_with_block_size (mtd, off)) { printf("Offset not aligned with a block (0x%x)\n",
cmd/mvebu/bubt.c +1 -1
@@ -137,7 +137,7 @@ static ulong get_load_addr(void) addr_str =env_get ("loadaddr" );if (addr_str) - addr =simple_strtoul (addr_str,NULL ,16 ); + addr =hextoul (addr_str,NULL );else addr =CONFIG_SYS_LOAD_ADDR ;
cmd/mvebu/comphy_rx_training.c +2 -2
@@ -25,8 +25,8 @@ int mvebu_comphy_rx_training_cmd(struct cmd_tbl *cmdtp, int flag, int argc,return -1 ; } - cp_index =simple_strtoul (argv[1 ],NULL ,16 ); - comphy_index =simple_strtoul (argv[2 ],NULL ,16 ); + cp_index =hextoul (argv[1 ],NULL ); + comphy_index =hextoul (argv[2 ],NULL ); ret =uclass_get (UCLASS_MISC , &uc);if (ret) {
cmd/nand.c +9 -9
@@ -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) {
cmd/net.c +3 -3
@@ -205,7 +205,7 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,/* pre-set image_load_addr */ s =env_get ("loadaddr" );if (s !=NULL ) - image_load_addr =simple_strtoul (s,NULL ,16 ); + image_load_addr =hextoul (s,NULL );switch (argc) {case 1 :
@@ -220,7 +220,7 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,* form must be written in a format which can not be * mis-interpreted as a valid number. */ - addr =simple_strtoul (argv[1 ], &end,16 ); + addr =hextoul (argv[1 ], &end);if (end == (argv[1 ] +strlen (argv[1 ]))) { image_load_addr = addr;/* refresh bootfile name from env */
@@ -234,7 +234,7 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,break ;case 3 : - image_load_addr =simple_strtoul (argv[1 ],NULL ,16 ); + image_load_addr =hextoul (argv[1 ],NULL ); net_boot_file_name_explicit = true;copy_filename (net_boot_file_name, argv[2 ],sizeof (net_boot_file_name));
cmd/nvedit.c +5 -5
@@ -358,7 +358,7 @@ ulong env_get_hex(const char *varname, ulong default_val) s =env_get (varname);if (s) - value =simple_strtoul (s, &endp,16 ); + value =hextoul (s, &endp);if (!s || endp == s)return default_val;
@@ -984,7 +984,7 @@ static int do_env_export(struct cmd_tbl *cmdtp, int flag,case 's' :/* size given */ if (--argc <=0 )return cmd_usage (cmdtp); - size =simple_strtoul (*++argv,NULL ,16 ); + size =hextoul (*++argv,NULL ); goto NXTARG;case 't' :/* text format */ if (fmt++)
@@ -1001,7 +1001,7 @@ NXTARG: ;if (argc <1 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[0 ],NULL ,16 ); + addr =hextoul (argv[0 ],NULL ); ptr =map_sysmem (addr, size);if (size)
@@ -1140,11 +1140,11 @@ static int do_env_import(struct cmd_tbl *cmdtp, int flag,if (sep !='\n' && crlf_is_lf ) crlf_is_lf =0 ; - addr =simple_strtoul (argv[0 ],NULL ,16 ); + addr =hextoul (argv[0 ],NULL ); ptr =map_sysmem (addr,0 );if (argc >=2 &&strcmp (argv[1 ],"-" )) { - size =simple_strtoul (argv[1 ],NULL ,16 ); + size =hextoul (argv[1 ],NULL ); }else if (chk) {puts ("## Error: external checksum format must pass size\n" );return CMD_RET_FAILURE ;
cmd/nvedit_efi.c +2 -2
@@ -471,12 +471,12 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc, argc--; argv++; - addr =simple_strtoul (argv[0 ], &ep,16 ); + addr =hextoul (argv[0 ], &ep);if (*ep !=':' )return CMD_RET_USAGE ;/* 0 should be allowed for delete */ - size =simple_strtoul (++ep,NULL ,16 ); + size =hextoul (++ep,NULL ); value_on_memory = true; }else if (!strcmp (argv[0 ],"-v" )) {
cmd/onenand.c +4 -4
@@ -398,7 +398,7 @@ static int do_onenand_read(struct cmd_tbl *cmdtp, int flag, int argc,if ((s !=NULL ) && (!strcmp (s,".oob" ))) oob =1 ; - addr = (ulong )simple_strtoul (argv[1 ],NULL ,16 ); + addr = (ulong )hextoul (argv[1 ],NULL );printf ("\nOneNAND read: " );if (arg_off_size_onenand (argc -2 , argv +2 , &ofs, &len) !=0 )
@@ -425,7 +425,7 @@ static int do_onenand_write(struct cmd_tbl *cmdtp, int flag, int argc,if (strncmp (argv[0 ] +6 ,"yaffs" ,5 ) ==0 ) withoob =1 ; - addr = (ulong )simple_strtoul (argv[1 ],NULL ,16 ); + addr = (ulong )hextoul (argv[1 ],NULL );printf ("\nOneNAND write: " );if (arg_off_size_onenand (argc -2 , argv +2 , &ofs, &len) !=0 )
@@ -512,7 +512,7 @@ static int do_onenand_dump(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; s =strchr (argv[0 ],'.' ); - ofs = (int )simple_strtoul (argv[1 ],NULL ,16 ); + ofs = (int )hextoul (argv[1 ],NULL );if (s !=NULL &&strcmp (s,".oob" ) ==0 ) ret =onenand_dump (mtd, ofs,1 );
@@ -535,7 +535,7 @@ static int do_onenand_markbad(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_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 "
cmd/osd.c +8 -8
@@ -99,10 +99,10 @@ static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_FAILURE ; } - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); hexstr = argv[3 ]; - count = (argc >4 ) ?simple_strtoul (argv[4 ],NULL ,16 ) :1 ; + count = (argc >4 ) ?hextoul (argv[4 ],NULL ) :1 ; buflen =strlen (hexstr) /2 ;
@@ -148,9 +148,9 @@ static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_FAILURE ; } - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); - color =simple_strtoul (argv[3 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); + color =hextoul (argv[3 ],NULL ); text = argv[4 ]; res =video_osd_print (osd_cur, x, y, color, text);
@@ -176,8 +176,8 @@ static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_FAILURE ; } - x =simple_strtoul (argv[1 ],NULL ,16 ); - y =simple_strtoul (argv[2 ],NULL ,16 ); + x =hextoul (argv[1 ],NULL ); + y =hextoul (argv[2 ],NULL ); res =video_osd_set_size (osd_cur, x, y);if (res) {
cmd/pcap.c +1 -1
@@ -18,7 +18,7 @@ static int do_pcap_init(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=3 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL ); size =simple_strtoul (argv[2 ],NULL ,10 );return pcap_init (addr, size) ?CMD_RET_FAILURE :CMD_RET_SUCCESS ;
cmd/pci.c +6 -6
@@ -470,14 +470,14 @@ static pci_dev_t get_pci_dev(char *name)if (name[i] =='.' ) {memcpy (cnum, &name[iold], i - iold); cnum[i - iold] ='\0' ; - bdfs[n++] =simple_strtoul (cnum,NULL ,16 ); + bdfs[n++] =hextoul (cnum,NULL ); iold = i +1 ; } }strcpy (cnum, &name[iold]);if (n ==0 ) n =1 ; - bdfs[n] =simple_strtoul (cnum,NULL ,16 ); + bdfs[n] =hextoul (cnum,NULL );return PCI_BDF (bdfs[0 ], bdfs[1 ], bdfs[2 ]); }
@@ -588,7 +588,7 @@ static int pci_cfg_modify(pci_dev_t bdf, ulong addr, ulong size, ulong value,#endif else {char *endp; - i =simple_strtoul (console_buffer, &endp,16 ); + i =hextoul (console_buffer, &endp); nbytes = endp - console_buffer;if (nbytes) {/* good enough to not time out
@@ -683,9 +683,9 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) cmd_size =cmd_get_data_size (argv[1 ],4 ); size = (cmd_size ==4 ) ?PCI_SIZE_32 : cmd_size -1 ;if (argc >3 ) - addr =simple_strtoul (argv[3 ],NULL ,16 ); + addr =hextoul (argv[3 ],NULL );if (argc >4 ) - value =simple_strtoul (argv[4 ],NULL ,16 ); + value =hextoul (argv[4 ],NULL );case 'h' :/* header */ #ifdef CONFIG_DM_PCI case 'b' :/* bars */
@@ -709,7 +709,7 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) argc--; }if (argc >1 ) - busnum =simple_strtoul (argv[1 ],NULL ,16 ); + busnum =hextoul (argv[1 ],NULL ); }#ifdef CONFIG_DM_PCI ret =uclass_get_device_by_seq (UCLASS_PCI , busnum, &bus);
cmd/pstore.c +7 -7
@@ -172,26 +172,26 @@ static int pstore_set(struct cmd_tbl *cmdtp, int flag, int argc,/* Address is specified since argc > 2 */ - pstore_addr =simple_strtoul (argv[1 ],NULL ,16 ); + pstore_addr =hextoul (argv[1 ],NULL );/* Length is specified since argc > 2 */ - pstore_length =simple_strtoul (argv[2 ],NULL ,16 ); + pstore_length =hextoul (argv[2 ],NULL );if (argc >3 ) - pstore_record_size =simple_strtoul (argv[3 ],NULL ,16 ); + pstore_record_size =hextoul (argv[3 ],NULL );if (argc >4 ) - pstore_console_size =simple_strtoul (argv[4 ],NULL ,16 ); + pstore_console_size =hextoul (argv[4 ],NULL );if (argc >5 ) - pstore_ftrace_size =simple_strtoul (argv[5 ],NULL ,16 ); + pstore_ftrace_size =hextoul (argv[5 ],NULL );if (argc >6 ) - pstore_pmsg_size =simple_strtoul (argv[6 ],NULL ,16 ); + pstore_pmsg_size =hextoul (argv[6 ],NULL );if (argc >7 ) - pstore_ecc_size =simple_strtoul (argv[7 ],NULL ,16 ); + pstore_ecc_size =hextoul (argv[7 ],NULL );if (pstore_length < (pstore_record_size + pstore_console_size + pstore_ftrace_size + pstore_pmsg_size)) {
cmd/pxe_utils.c +2 -2
@@ -351,7 +351,7 @@ static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *labelint err;/* Get the main fdt and map it */ - fdt_addr =simple_strtoul (env_get ("fdt_addr_r" ),NULL ,16 ); + fdt_addr =hextoul (env_get ("fdt_addr_r" ),NULL ); working_fdt =map_sysmem (fdt_addr,0 ); err =fdt_check_header (working_fdt);if (err)
@@ -364,7 +364,7 @@ static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *labelreturn ; } - fdtoverlay_addr =simple_strtoul (fdtoverlay_addr_env,NULL ,16 ); + fdtoverlay_addr =hextoul (fdtoverlay_addr_env,NULL );/* Cycle over the overlay files and apply them in order */ do {
cmd/qfw.c +5 -5
@@ -120,7 +120,7 @@ static int qemu_fwcfg_do_load(struct cmd_tbl *cmdtp, int flag, env =env_get ("loadaddr" ); load_addr = env ? - (void *)simple_strtoul (env,NULL ,16 ) : + (void *)hextoul (env,NULL ) : #ifdef CONFIG_LOADADDR (void *)CONFIG_LOADADDR;#else
@@ -129,7 +129,7 @@ static int qemu_fwcfg_do_load(struct cmd_tbl *cmdtp, int flag, env =env_get ("ramdiskaddr" ); initrd_addr = env ? - (void *)simple_strtoul (env,NULL ,16 ) : + (void *)hextoul (env,NULL ) : #ifdef CONFIG_RAMDISK_ADDR (void *)CONFIG_RAMDISK_ADDR;#else
@@ -137,10 +137,10 @@ static int qemu_fwcfg_do_load(struct cmd_tbl *cmdtp, int flag,#endif if (argc ==2 ) { - load_addr = (void *)simple_strtoul (argv[0 ],NULL ,16 ); - initrd_addr = (void *)simple_strtoul (argv[1 ],NULL ,16 ); + load_addr = (void *)hextoul (argv[0 ],NULL ); + initrd_addr = (void *)hextoul (argv[1 ],NULL ); }else if (argc ==1 ) { - load_addr = (void *)simple_strtoul (argv[0 ],NULL ,16 ); + load_addr = (void *)hextoul (argv[0 ],NULL ); }if (!load_addr || !initrd_addr) {
cmd/read.c +5 -5
@@ -30,13 +30,13 @@ int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } - dev = (int )simple_strtoul (argv[2 ], &ep,16 ); + dev = (int )hextoul (argv[2 ], &ep);if (*ep) {if (*ep !=':' ) {printf ("Invalid block device %s\n" , argv[2 ]);return 1 ; } - part = (int )simple_strtoul (++ep,NULL ,16 ); + part = (int )hextoul (++ep,NULL ); } dev_desc =blk_get_dev (argv[1 ], dev);
@@ -45,9 +45,9 @@ int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return 1 ; } - addr = (void *)simple_strtoul (argv[3 ],NULL ,16 ); - blk =simple_strtoul (argv[4 ],NULL ,16 ); - cnt =simple_strtoul (argv[5 ],NULL ,16 ); + addr = (void *)hextoul (argv[3 ],NULL ); + blk =hextoul (argv[4 ],NULL ); + cnt =hextoul (argv[5 ],NULL );if (part !=0 ) {if (part_get_info (dev_desc, part, &part_info)) {
cmd/reiser.c +5 -5
@@ -90,7 +90,7 @@ int do_reiserload(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])case 3 : addr_str =env_get ("loadaddr" );if (addr_str !=NULL ) { - addr =simple_strtoul (addr_str,NULL ,16 ); + addr =hextoul (addr_str,NULL ); }else { addr =CONFIG_SYS_LOAD_ADDR ; }
@@ -98,19 +98,19 @@ int do_reiserload(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) count =0 ;break ;case 4 : - addr =simple_strtoul (argv[3 ],NULL ,16 ); + addr =hextoul (argv[3 ],NULL ); filename =env_get ("bootfile" ); count =0 ;break ;case 5 : - addr =simple_strtoul (argv[3 ],NULL ,16 ); + addr =hextoul (argv[3 ],NULL ); filename = argv[4 ]; count =0 ;break ;case 6 : - addr =simple_strtoul (argv[3 ],NULL ,16 ); + addr =hextoul (argv[3 ],NULL ); filename = argv[4 ]; - count =simple_strtoul (argv[5 ],NULL ,16 ); + count =hextoul (argv[5 ],NULL );break ;default :
cmd/remoteproc.c +2 -2
@@ -130,9 +130,9 @@ static int do_remoteproc_load(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; id = (int )simple_strtoul (argv[1 ],NULL ,10 ); - addr =simple_strtoul (argv[2 ],NULL ,16 ); + addr =hextoul (argv[2 ],NULL ); - size =simple_strtoul (argv[3 ],NULL ,16 ); + size =hextoul (argv[3 ],NULL );if (!size) {printf ("\t Expect some size??\n" );
cmd/rng.c +1 -1
@@ -24,7 +24,7 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }if (argc >=2 ) - n =simple_strtoul (argv[1 ],NULL ,16 ); + n =hextoul (argv[1 ],NULL ); buf =malloc (n);if (!buf) {
cmd/rtc.c +6 -6
@@ -18,13 +18,13 @@ static int do_rtc_read(struct udevice *dev, int argc, char * const argv[])if (argc <2 || argc >3 )return CMD_RET_USAGE ; - reg =simple_strtoul (argv[0 ],NULL ,16 ); - len =simple_strtoul (argv[1 ],NULL ,16 ); + reg =hextoul (argv[0 ],NULL ); + len =hextoul (argv[1 ],NULL );if (argc ==3 ) {u8 *addr; - addr =map_sysmem (simple_strtoul (argv[2 ],NULL ,16 ), len); + addr =map_sysmem (hextoul (argv[2 ],NULL ), len); ret =dm_rtc_read (dev, reg, addr, len);unmap_sysmem (addr);if (ret) {
@@ -59,13 +59,13 @@ static int do_rtc_write(struct udevice *dev, int argc, char * const argv[])if (argc <2 || argc >3 )return CMD_RET_USAGE ; - reg =simple_strtoul (argv[0 ],NULL ,16 ); + reg =hextoul (argv[0 ],NULL );if (argc ==3 ) {u8 *addr; - len =simple_strtoul (argv[1 ],NULL ,16 ); - addr =map_sysmem (simple_strtoul (argv[2 ],NULL ,16 ), len); + len =hextoul (argv[1 ],NULL ); + addr =map_sysmem (hextoul (argv[2 ],NULL ), len); ret =dm_rtc_write (dev, reg, addr, len);unmap_sysmem (addr);if (ret) {
cmd/setexpr.c +2 -2
@@ -45,7 +45,7 @@ static int get_arg(char *s, int w, struct expr_arg *argp)int len;char *str; - addr =simple_strtoul (&s[1 ],NULL ,16 ); + addr =hextoul (&s[1 ],NULL );switch (w) {case 1 : p =map_sysmem (addr,sizeof (uchar));
@@ -90,7 +90,7 @@ static int get_arg(char *s, int w, struct expr_arg *argp) }else {if (w ==CMD_DATA_SIZE_STR )return -EINVAL ; - arg.ival =simple_strtoul (s,NULL ,16 );
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 02/14] global: Convert simple_strtoul() with hex to hextoul()
Quoted 6 lines · Simon Glass
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 <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 3/14 global: Convert simple_strtoul() with decimal to dectoul()
In reply to Simon GlassIt 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.
---
(no changes since v1)
arch/arm/cpu/armv8/fsl-layerscape/soc.c | 2 +- arch/arm/mach-imx/cmd_dek.c | 2 +- arch/arm/mach-imx/cmd_mfgprot.c | 2 +- arch/arm/mach-imx/imx8/snvs_security_sc.c | 2 +- arch/arm/mach-keystone/cmd_clock.c | 10 ++--- arch/arm/mach-kirkwood/cpu.c | 2 +- arch/arm/mach-nexell/clock.c | 2 +- .../cmd_stm32prog/cmd_stm32prog.c | 2 +- .../mach-stm32mp/cmd_stm32prog/stm32prog.c | 2 +- arch/powerpc/cpu/mpc83xx/ecc.c | 4 +- board/Arcturus/ucp1020/ucp1020.c | 2 +- board/BuS/eb_cpu5282/eb_cpu5282.c | 8 ++-- board/atmel/common/board.c | 2 +- board/cavium/thunderx/atf.c | 24 +++++------ board/compulab/common/eeprom.c | 2 +- board/compulab/common/omap3_display.c | 2 +- board/davinci/da8xxevm/da850evm.c | 2 +- board/freescale/common/pixis.c | 8 ++-- board/freescale/common/sys_eeprom.c | 2 +- board/gateworks/gw_ventana/gsc.c | 4 +- board/gateworks/gw_ventana/gw_ventana.c | 2 +- board/gateworks/venice/gsc.c | 2 +- board/gdsys/common/cmd_ioloop.c | 16 ++++---- board/samsung/common/exynos5-dt.c | 2 +- board/samsung/odroid/odroid.c | 2 +- board/siemens/taurus/taurus.c | 5 +-- .../unmatched/hifive-platform-i2c-eeprom.c | 6 +-- board/synopsys/hsdk/env-lib.c | 2 +- board/toradex/common/tdx-cfg-block.c | 14 +++---- board/varisys/common/sys_eeprom.c | 2 +- .../work_92105/work_92105_display.c | 3 +- cmd/avb.c | 2 +- cmd/axi.c | 8 ++-- cmd/bind.c | 4 +- cmd/binop.c | 2 +- cmd/blk_common.c | 4 +- cmd/bmp.c | 4 +- cmd/clk.c | 2 +- cmd/clone.c | 2 +- cmd/cros_ec.c | 4 +- cmd/demo.c | 2 +- cmd/exit.c | 2 +- cmd/flash.c | 6 +-- cmd/gpio.c | 4 +- cmd/gpt.c | 2 +- cmd/i2c.c | 8 ++-- cmd/led.c | 2 +- cmd/legacy_led.c | 2 +- cmd/load.c | 6 +-- cmd/log.c | 4 +- cmd/mbr.c | 2 +- cmd/mem.c | 4 +- cmd/mmc.c | 40 +++++++++---------- cmd/mp.c | 2 +- cmd/nand.c | 2 +- cmd/nvedit.c | 2 +- cmd/optee_rpmb.c | 2 +- cmd/osd.c | 4 +- cmd/pcap.c | 2 +- cmd/pstore.c | 2 +- cmd/pwm.c | 10 ++--- cmd/remoteproc.c | 6 +-- cmd/rtc.c | 2 +- cmd/sata.c | 2 +- cmd/sleep.c | 2 +- cmd/sound.c | 4 +- cmd/spi.c | 10 ++--- cmd/ti/pd.c | 4 +- cmd/tpm-common.c | 2 +- cmd/ufs.c | 2 +- cmd/usb.c | 6 +-- cmd/w1.c | 8 ++-- common/bedbug.c | 2 +- common/lcd_console.c | 4 +- disk/part_amiga.c | 4 +- drivers/dfu/dfu_mmc.c | 2 +- drivers/dfu/dfu_mtd.c | 2 +- drivers/dfu/dfu_nand.c | 4 +- drivers/dfu/dfu_sf.c | 4 +- drivers/dfu/dfu_virt.c | 2 +- drivers/gpio/gpio-uclass.c | 2 +- drivers/gpio/mxs_gpio.c | 4 +- drivers/gpio/tca642x.c | 4 +- drivers/net/e1000.c | 2 +- drivers/net/fsl-mc/mc.c | 2 +- drivers/net/netconsole.c | 6 +-- drivers/net/pfe_eth/pfe_firmware.c | 2 +- drivers/net/phy/b53.c | 4 +- drivers/net/phy/mv88e6352.c | 12 +++--- drivers/net/qe/dm_qe_uec.c | 4 +- drivers/pinctrl/nexell/pinctrl-nexell.c | 2 +- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/ram/octeon/octeon_ddr.c | 2 +- drivers/serial/serial-uclass.c | 2 +- drivers/serial/serial.c | 2 +- drivers/usb/cdns3/gadget.c | 2 +- drivers/usb/gadget/epautoconf.c | 2 +- drivers/usb/gadget/ether.c | 3 +- drivers/video/vidconsole-uclass.c | 4 +- examples/standalone/atmel_df_pow2.c | 5 ++- include/vsprintf.h | 13 ++++++ lib/dhry/cmd_dhry.c | 2 +- lib/fdtdec.c | 2 +- lib/net_utils.c | 2 +- lib/strto.c | 7 +++- net/bootp.c | 2 +- net/eth-uclass.c | 4 +- net/eth_legacy.c | 2 +- net/net.c | 2 +- net/tftp.c | 13 +++--- test/str_ut.c | 12 ++++++ 111 files changed, 255 insertions(+), 230 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +1 -1
@@ -277,7 +277,7 @@ static unsigned long get_internval_val_mhz(void)ulong interval_mhz =get_bus_freq (0 ) / (1000 *1000 );if (interval) - interval_mhz =simple_strtoul (interval,NULL ,10 ); + interval_mhz =dectoul (interval,NULL );return interval_mhz; }
arch/arm/mach-imx/cmd_dek.c +1 -1
@@ -302,7 +302,7 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc, src_addr =hextoul (argv[1 ],NULL ); dst_addr =hextoul (argv[2 ],NULL ); - len =simple_strtoul (argv[3 ],NULL ,10 ); + len =dectoul (argv[3 ],NULL );return blob_encap_dek (src_addr, dst_addr, len); }
arch/arm/mach-imx/cmd_mfgprot.c +1 -1
@@ -72,7 +72,7 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])return CMD_RET_USAGE ; m_addr =hextoul (argv[2 ],NULL ); - m_size =simple_strtoul (argv[3 ],NULL ,10 ); + m_size =dectoul (argv[3 ],NULL ); m_ptr =map_physmem (m_addr, m_size,MAP_NOCACHE );if (!m_ptr)return -ENOMEM ;
arch/arm/mach-imx/imx8/snvs_security_sc.c +1 -1
@@ -726,7 +726,7 @@ static int do_tamper_pin_cfg(struct cmd_tbl *cmdtp, int flag, int argc,if (argc != (2 +1 ))return CMD_RET_USAGE ; - conf.pad =simple_strtoul (argv[++idx],NULL ,10 ); + conf.pad =dectoul (argv[++idx],NULL ); conf.mux_conf =hextoul (argv[++idx],NULL ); err =apply_tamper_pin_list_config (&conf,1 );
arch/arm/mach-keystone/cmd_clock.c +5 -5
@@ -42,9 +42,9 @@ int do_pll_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])else goto pll_cmd_usage; - cmd_pll_data.pll_m =simple_strtoul (argv[2 ],NULL ,10 ); - cmd_pll_data.pll_d =simple_strtoul (argv[3 ],NULL ,10 ); - cmd_pll_data.pll_od =simple_strtoul (argv[4 ],NULL ,10 ); + cmd_pll_data.pll_m =dectoul (argv[2 ],NULL ); + cmd_pll_data.pll_d =dectoul (argv[3 ],NULL ); + cmd_pll_data.pll_od =dectoul (argv[4 ],NULL ); printf("Trying to set pll %d; mult %d; div %d; OD %d\n", cmd_pll_data.pll, cmd_pll_data.pll_m,
@@ -72,7 +72,7 @@ int do_getclk_cmd(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=2 ) goto getclk_cmd_usage; - clk =simple_strtoul (argv[1 ],NULL ,10 ); + clk =dectoul (argv[1 ],NULL ); freq =ks_clk_get_rate (clk);if (freq)
@@ -101,7 +101,7 @@ int do_psc_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc !=3 ) goto psc_cmd_usage; - psc_module =simple_strtoul (argv[1 ],NULL ,10 ); + psc_module =dectoul (argv[1 ],NULL );if (strcmp (argv[2 ],"en" ) ==0 ) { res =psc_enable_module (psc_module); printf("psc_enable_module(%d) - %s\n", psc_module,
arch/arm/mach-kirkwood/cpu.c +1 -1
@@ -125,7 +125,7 @@ static void kw_sysrst_check(void)return ;/* read sysrstdelay value */ - sysrst_dly = (u32 )simple_strtoul (s,NULL ,10 ); + sysrst_dly = (u32 )dectoul (s,NULL );/* read SysRst Length counter register (bits 28:0) */ sysrst_cnt = (0x1fffffff &readl (KW_REG_SYSRST_CNT ));
arch/arm/mach-nexell/clock.c +1 -1
@@ -592,7 +592,7 @@ struct clk *clk_get(const char *id) c =strrchr ((const char *)str, (int )'.' );if (!c || !cdev->peri)break ; - devid =simple_strtoul (++c,NULL ,10 ); + devid =dectoul (++c,NULL );if (cdev->peri->dev_id == devid)break ; }
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +1 -1
@@ -59,7 +59,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } - dev = (int )simple_strtoul (argv[2 ],NULL ,10 ); + dev = (int )dectoul (argv[2 ],NULL ); addr =STM32_DDR_BASE ; size =0 ;
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +1 -1
@@ -253,7 +253,7 @@ static int parse_type(struct stm32prog_data *data, result = -EINVAL ; else part->bin_nb = -simple_strtoul (&p[7 ],NULL ,10 ); +dectoul (&p[7 ],NULL ); } }else if (!strcmp (p,"System" )) { part->part_type =PART_SYSTEM ;
arch/powerpc/cpu/mpc83xx/ecc.c +2 -2
@@ -138,7 +138,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }if (argc ==3 ) {if (strcmp (argv[1 ],"sbecnt" ) ==0 ) { - val =simple_strtoul (argv[2 ],NULL ,10 ); + val =dectoul (argv[2 ],NULL );if (val >255 ) {printf ("Incorrect Counter value, " "should be 0..255\n" );
@@ -151,7 +151,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ddr->err_sbe = val;return 0 ; }else if (strcmp (argv[1 ],"sbethr" ) ==0 ) { - val =simple_strtoul (argv[2 ],NULL ,10 ); + val =dectoul (argv[2 ],NULL );if (val >255 ) {printf ("Incorrect Counter value, " "should be 0..255\n" );
board/Arcturus/ucp1020/ucp1020.c +1 -1
@@ -52,7 +52,7 @@ void spi_set_speed(struct spi_slave *slave, uint hz)*/ int name_to_gpio (const char *name) { -int gpio =31 -simple_strtoul (name,NULL ,10 ); +int gpio =31 -dectoul (name,NULL );if (gpio <16 ) gpio =-1 ;
board/BuS/eb_cpu5282/eb_cpu5282.c +4 -4
@@ -194,13 +194,13 @@ int drv_video_init(void)printf ("Init Video as " ); s =env_get ("displaywidth" );if (s !=NULL ) - display_width =simple_strtoul (s,NULL ,10 ); + display_width =dectoul (s,NULL );else display_width =256 ; s =env_get ("displayheight" );if (s !=NULL ) - display_height =simple_strtoul (s,NULL ,10 ); + display_height =dectoul (s,NULL );else display_height =256 ;
@@ -234,8 +234,8 @@ int do_brightness(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])switch (argc) {case 3 : - side =simple_strtoul (argv[1 ],NULL ,10 ); - bright =simple_strtoul (argv[2 ],NULL ,10 ); + side =dectoul (argv[1 ],NULL ); + bright =dectoul (argv[2 ],NULL );if ((side >=0 ) && (side <=3 ) && (bright >=0 ) && (bright <=1000 )) {vcxk_setbrightness (side, bright);
board/atmel/common/board.c +1 -1
@@ -47,7 +47,7 @@ void at91_pda_detect(void)break ; } } - pda =simple_strtoul ((const char *)buf,NULL ,10 ); + pda =dectoul ((const char *)buf,NULL );switch (pda) {case 7000 :
board/cavium/thunderx/atf.c +12 -12
@@ -236,47 +236,47 @@ int do_atf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])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" )) {
board/compulab/common/eeprom.c +1 -1
@@ -153,7 +153,7 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)*/ if (cl_eeprom_layout ==LAYOUT_LEGACY ) {sprintf (str,"%x" , board_rev); - board_rev =simple_strtoul (str,NULL ,10 ); + board_rev =dectoul (str,NULL ); }return board_rev;
board/compulab/common/omap3_display.c +1 -1
@@ -244,7 +244,7 @@ static int parse_pixclock(char *pixclock)int divisor, pixclock_val;char *pixclk_start = pixclock; - pixclock_val =simple_strtoul (pixclock, &pixclock,10 ); + pixclock_val =dectoul (pixclock, &pixclock); divisor =DIV_ROUND_UP (PIXEL_CLK_NUMERATOR , pixclock_val);/* 0 and 1 are illegal values for PCD */ if (divisor <=1 )
board/davinci/da8xxevm/da850evm.c +1 -1
@@ -284,7 +284,7 @@ u32 get_board_rev(void) s =env_get ("maxcpuclk" );if (s) - maxcpuclk =simple_strtoul (s,NULL ,10 ); + maxcpuclk =dectoul (s,NULL );if (maxcpuclk >=456000000 ) rev =3 ;
board/freescale/common/pixis.c +4 -4
@@ -403,10 +403,10 @@ static unsigned long strfractoint(char *strptr) mulconst =1 ;for (i =0 ; i < j; i++) mulconst *=10 ; - decval =simple_strtoul (decarr,NULL ,10 ); + decval =dectoul (decarr,NULL ); } - intval =simple_strtoul (intarr,NULL ,10 ); + intval =dectoul (intarr,NULL ); intval = intval * mulconst;return intval + decval;
@@ -489,9 +489,9 @@ static int pixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,unsigned long corepll;unsigned long mpxpll; - sysclk =simple_strtoul (p_cf_sysclk,NULL ,10 ); + sysclk =dectoul (p_cf_sysclk,NULL ); corepll =strfractoint (p_cf_corepll); - mpxpll =simple_strtoul (p_cf_mpxpll,NULL ,10 ); + mpxpll =dectoul (p_cf_mpxpll,NULL ); if (!(set_px_sysclk(sysclk) && set_px_corepll(corepll)
board/freescale/common/sys_eeprom.c +1 -1
@@ -456,7 +456,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])update_crc ();break ; case '0' ... '9': /* "mac 0" through "mac 22" */ -set_mac_address (simple_strtoul (argv[1 ],NULL ,10 ), argv[2 ]); +set_mac_address (dectoul (argv[1 ],NULL ), argv[2 ]);break ;case 'h' :/* help */ default :
board/gateworks/gw_ventana/gsc.c +2 -2
@@ -277,7 +277,7 @@ static int do_gsc_sleep(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <2 )return CMD_RET_USAGE ; - secs =simple_strtoul (argv[1 ],NULL ,10 ); + secs =dectoul (argv[1 ],NULL );printf ("GSC Sleeping for %ld seconds\n" , secs);i2c_set_bus_num (0 );
@@ -322,7 +322,7 @@ static int do_gsc_wd(struct cmd_tbl *cmdtp, int flag, int argc,int timeout =0 ;if (argc >2 ) - timeout =simple_strtoul (argv[2 ],NULL ,10 ); + timeout =dectoul (argv[2 ],NULL );i2c_set_bus_num (0 );if (gsc_i2c_read (GSC_SC_ADDR ,GSC_SC_CTRL1 ,1 , ®,1 ))return CMD_RET_FAILURE ;
board/gateworks/gw_ventana/gw_ventana.c +1 -1
@@ -471,7 +471,7 @@ void get_board_serial(struct tag_serialnr *serialnr)if (serial) { serialnr->high =0 ; - serialnr->low =simple_strtoul (serial,NULL ,10 ); + serialnr->low =dectoul (serial,NULL ); }else if (ventana_info.model[0 ]) { serialnr->high =0 ; serialnr->low = ventana_info.serial;
board/gateworks/venice/gsc.c +1 -1
@@ -660,7 +660,7 @@ static int do_gsc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]if (strcasecmp (argv[1 ],"sleep" ) ==0 ) {if (argc <3 )return CMD_RET_USAGE ; -if (!gsc_sleep (simple_strtoul (argv[2 ],NULL ,10 ))) +if (!gsc_sleep (dectoul (argv[2 ],NULL )))return CMD_RET_SUCCESS ; }else if (strcasecmp (argv[1 ],"hwmon" ) ==0 ) {if (!gsc_hwmon ())
board/gdsys/common/cmd_ioloop.c +8 -8
@@ -275,13 +275,13 @@ int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc <2 )return CMD_RET_USAGE ; - fpga =simple_strtoul (argv[1 ],NULL ,10 ); + fpga =dectoul (argv[1 ],NULL );/* * If another parameter, it is the report rate in packets. */ if (argc >2 ) - rate =simple_strtoul (argv[2 ],NULL ,10 ); + rate =dectoul (argv[2 ],NULL );/* Enable receive path */ FPGA_SET_REG (fpga, ep.rx_tx_control,CTRL_PROC_RECEIVE_ENABLE );
@@ -388,18 +388,18 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])/* * FPGA is specified since argc > 2 */ - fpga =simple_strtoul (argv[1 ],NULL ,10 ); + fpga =dectoul (argv[1 ],NULL );/* * packet size is specified since argc > 2 */ - size =simple_strtoul (argv[2 ],NULL ,10 ); + size =dectoul (argv[2 ],NULL );/* * If another parameter, it is the test rate in packets per second. */ if (argc >3 ) - rate =simple_strtoul (argv[3 ],NULL ,10 ); + rate =dectoul (argv[3 ],NULL );/* enable receive path */ FPGA_SET_REG (fpga, ep.rx_tx_control,CTRL_PROC_RECEIVE_ENABLE );
@@ -463,13 +463,13 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])/* * packet size is specified since argc > 1 */ - size =simple_strtoul (argv[2 ],NULL ,10 ); + size =dectoul (argv[2 ],NULL );/* * If another parameter, it is the test rate in packets per second. */ if (argc >2 ) - rate =simple_strtoul (argv[3 ],NULL ,10 ); + rate =dectoul (argv[3 ],NULL );/* Enable receive path */ misc_set_enabled (dev, true);
@@ -514,7 +514,7 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return CMD_RET_FAILURE ;if (argc >1 ) { -int i =simple_strtoul (argv[1 ],NULL ,10 ); +int i =dectoul (argv[1 ],NULL );snprintf (name,sizeof (name),"ioep%d" , i);
board/samsung/common/exynos5-dt.c +1 -1
@@ -169,7 +169,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)if (board_is_odroidxu4 () ||board_is_odroidhc1 () ||board_is_odroidhc2 ())return info; - dev_num =simple_strtoul (devstr,NULL ,10 ); + dev_num =dectoul (devstr,NULL ); mmc =find_mmc_device (dev_num);if (!mmc)
board/samsung/odroid/odroid.c +1 -1
@@ -85,7 +85,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)char *alt_boot;int dev_num; - dev_num =simple_strtoul (devstr,NULL ,10 ); + dev_num =dectoul (devstr,NULL ); mmc =find_mmc_device (dev_num);if (!mmc)
board/siemens/taurus/taurus.c +2 -3
@@ -394,10 +394,9 @@ static int do_upgrade_available(struct cmd_tbl *cmdtp, int flag, int argc,unsigned long boot_retry =0 ;char boot_buf[10 ]; - upgrade_available =simple_strtoul (env_get ("upgrade_available" ),NULL , -10 ); + upgrade_available =dectoul (env_get ("upgrade_available" ),NULL );if (upgrade_available) { - boot_retry =simple_strtoul (env_get ("boot_retries" ),NULL ,10 ); + boot_retry =dectoul (env_get ("boot_retries" ),NULL ); boot_retry++;sprintf (boot_buf,"%lx" , boot_retry);env_set ("boot_retries" , boot_buf);
board/sifive/unmatched/hifive-platform-i2c-eeprom.c +3 -3
@@ -324,7 +324,7 @@ static void set_pcb_revision(char *string) {unsigned long p; - p =simple_strtoul (string, &string,10 ); + p =dectoul (string, &string);if (p >U8_MAX ) {printf ("%s must not be greater than %d\n" ,"PCB revision" ,U8_MAX );
@@ -366,7 +366,7 @@ static void set_bom_variant(char *string) {unsigned long p; - p =simple_strtoul (string, &string,10 ); + p =dectoul (string, &string);if (p >U8_MAX ) {printf ("%s must not be greater than %d\n" ,"BOM variant" ,U8_MAX );
@@ -389,7 +389,7 @@ static void set_product_id(char *string) {unsigned long p; - p =simple_strtoul (string, &string,10 ); + p =dectoul (string, &string);if (p >U16_MAX ) {printf ("%s must not be greater than %d\n" ,"Product ID" ,U16_MAX );
board/synopsys/hsdk/env-lib.c +1 -1
@@ -254,7 +254,7 @@ static int arg_read_set(const struct env_map_common *map, u32 i, int argc,if (map[i].type ==ENV_HEX ) map[i].val->val =hextoul (argv[1 ], &endp);else - map[i].val->val =simple_strtoul (argv[1 ], &endp,10 ); + map[i].val->val =dectoul (argv[1 ], &endp); map[i].val->set = true;
board/toradex/common/tdx-cfg-block.c +7 -7
@@ -548,7 +548,7 @@ static int get_cfgblock_interactive(void) len =cli_readline (message); } - tdx_serial =simple_strtoul (console_buffer,NULL ,10 ); + tdx_serial =dectoul (console_buffer,NULL );return 0 ; }
@@ -566,14 +566,14 @@ static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,/* Get hardware information from the first 8 digits */ tag->ver_major = barcode[4 ] -'0' ; tag->ver_minor = barcode[5 ] -'0' ; - tag->ver_assembly =simple_strtoul (revision,NULL ,10 ); + tag->ver_assembly =dectoul (revision,NULL ); barcode[4 ] ='\0' ; - tag->prodid =simple_strtoul (barcode,NULL ,10 ); + tag->prodid =dectoul (barcode,NULL );/* Parse second part of the barcode (serial number */ barcode +=8 ; - *serial =simple_strtoul (barcode,NULL ,10 ); + *serial =dectoul (barcode,NULL );return 0 ; }
@@ -710,7 +710,7 @@ int try_migrate_tdx_cfg_block_carrier(void) tdx_car_hw_tag.ver_assembly = pid8[7 ] -'0' ; pid8[4 ] ='\0' ; - tdx_car_hw_tag.prodid =simple_strtoul (pid8,NULL ,10 ); + tdx_car_hw_tag.prodid =dectoul (pid8,NULL );/* Valid Tag */ write_tag (config_block, &offset,TAG_VALID ,NULL ,0 );
@@ -754,7 +754,7 @@ static int get_cfgblock_carrier_interactive(void)sprintf (message,"Choose your carrier board (provide ID): " ); len =cli_readline (message); - tdx_car_hw_tag.prodid =simple_strtoul (console_buffer,NULL ,10 ); + tdx_car_hw_tag.prodid =dectoul (console_buffer,NULL ); do { sprintf(message, "Enter carrier board version (e.g. V1.1B): V");
@@ -770,7 +770,7 @@ static int get_cfgblock_carrier_interactive(void) len =cli_readline (message); } - tdx_car_serial =simple_strtoul (console_buffer,NULL ,10 ); + tdx_car_serial =dectoul (console_buffer,NULL );return 0 ; }
board/varisys/common/sys_eeprom.c +1 -1
@@ -368,7 +368,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])update_crc ();break ; case '0' ... '9': /* "mac 0" through "mac 22" */ -set_mac_address (simple_strtoul (argv[1 ],NULL ,10 ), argv[2 ]); +set_mac_address (dectoul (argv[1 ],NULL ), argv[2 ]);break ;case 'h' :/* help */ default :
board/work-microwave/work_92105/work_92105_display.c +1 -2
@@ -233,8 +233,7 @@ void work_92105_display_init(void)/* set display contrast */ display_contrast_str =env_get ("fwopt_dispcontrast" );if (display_contrast_str) - display_contrast =simple_strtoul (display_contrast_str, -NULL ,10 ); + display_contrast =dectoul (display_contrast_str,NULL );i2c_write (0x2c ,0x00 ,1 , &display_contrast,1 );/* request GPO_15 as an output initially set to 1 */
cmd/avb.c +1 -1
@@ -366,7 +366,7 @@ int do_avb_read_pvalue(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; name = argv[1 ]; - bytes =simple_strtoul (argv[2 ], &endp,10 ); + bytes =dectoul (argv[2 ], &endp);if (*endp && *endp !='\n' )return CMD_RET_USAGE ;
cmd/axi.c +4 -4
@@ -120,7 +120,7 @@ static int do_axi_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,int i;/* show specific bus */ - i =simple_strtoul (argv[1 ],NULL ,10 ); + i =dectoul (argv[1 ],NULL );struct udevice *bus;int ret;
@@ -153,7 +153,7 @@ static int do_axi_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,printf ("Current bus is %d\n" , bus_no); }else { - bus_no =simple_strtoul (argv[1 ],NULL ,10 ); + bus_no =dectoul (argv[1 ],NULL );printf ("Setting bus to %d\n" , bus_no); ret =axi_set_cur_bus (bus_no);
@@ -193,7 +193,7 @@ static int do_axi_md(struct cmd_tbl *cmdtp, int flag, int argc, }if ((flag &CMD_FLAG_REPEAT ) ==0 ) { - size =simple_strtoul (argv[1 ],NULL ,10 ); + size =dectoul (argv[1 ],NULL );/* * Address is specified since argc >= 3
@@ -273,7 +273,7 @@ static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <=3 || argc >=6 )return CMD_RET_USAGE ; - size =simple_strtoul (argv[1 ],NULL ,10 ); + size =dectoul (argv[1 ],NULL );switch (size) {case 8 :
cmd/bind.c +2 -2
@@ -218,13 +218,13 @@ static int do_bind_unbind(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; ret =unbind_by_node_path (argv[1 ]); }else if (!by_node && bind) { -int index = (argc >2 ) ?simple_strtoul (argv[2 ],NULL ,10 ) :0 ; +int index = (argc >2 ) ?dectoul (argv[2 ],NULL ) :0 ;if (argc !=4 )return CMD_RET_USAGE ; ret =bind_by_class_index (argv[1 ], index, argv[3 ]); }else if (!by_node && !bind) { -int index = (argc >2 ) ?simple_strtoul (argv[2 ],NULL ,10 ) :0 ; +int index = (argc >2 ) ?dectoul (argv[2 ],NULL ) :0 ;if (argc ==3 ) ret =unbind_by_class_index (argv[1 ], index);
cmd/binop.c +1 -1
@@ -89,7 +89,7 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc,else return CMD_RET_USAGE ; - len =simple_strtoul (lenarg,NULL ,10 ); + len =dectoul (lenarg,NULL ); src1 =malloc (len); src2 =malloc (len);
cmd/blk_common.c +2 -2
@@ -40,7 +40,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,return CMD_RET_USAGE ;case 3 :if (strncmp (argv[1 ],"dev" ,3 ) ==0 ) { -int dev = (int )simple_strtoul (argv[2 ],NULL ,10 ); +int dev = (int )dectoul (argv[2 ],NULL );if (!blk_show_device (if_type, dev)) { *cur_devnump = dev;
@@ -50,7 +50,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type, }return 0 ; }else if (strncmp (argv[1 ],"part" ,4 ) ==0 ) { -int dev = (int )simple_strtoul (argv[2 ],NULL ,10 ); +int dev = (int )dectoul (argv[2 ],NULL );if (blk_print_part_devnum (if_type, dev)) { printf("\n%s device %d not available\n",
cmd/bmp.c +2 -2
@@ -131,11 +131,11 @@ static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc,if (!strcmp (argv[2 ],"m" )) x =BMP_ALIGN_CENTER ;else - x =simple_strtoul (argv[2 ],NULL ,10 ); + x =dectoul (argv[2 ],NULL );if (!strcmp (argv[3 ],"m" )) y =BMP_ALIGN_CENTER ;else - y =simple_strtoul (argv[3 ],NULL ,10 ); + y =dectoul (argv[3 ],NULL );break ;default :return CMD_RET_USAGE ;
cmd/clk.c +1 -1
@@ -120,7 +120,7 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,s32 freq;struct udevice *dev; - freq =simple_strtoul (argv[2 ],NULL ,10 ); + freq =dectoul (argv[2 ],NULL ); dev =clk_lookup (argv[1 ]);
cmd/clone.c +1 -1
@@ -34,7 +34,7 @@ static int do_clone(struct cmd_tbl *cmdtp, int flag, int argc, char * const argvprintf ("Unable to open destination device\n" );return 1 ; } - requested =simple_strtoul (argv[5 ], &unit,10 ); + requested =dectoul (argv[5 ], &unit); srcbz = srcdesc->blksz; destbz = destdesc->blksz;
cmd/cros_ec.c +2 -2
@@ -501,11 +501,11 @@ static int do_cros_ec(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <3 )return CMD_RET_USAGE ; - index =simple_strtoul (argv[2 ], &endp,10 ); + index =dectoul (argv[2 ], &endp);if (*argv[2 ] ==0 || *endp !=0 )return CMD_RET_USAGE ;if (argc >3 ) { - state =simple_strtoul (argv[3 ], &endp,10 ); + state =dectoul (argv[3 ], &endp);if (*argv[3 ] ==0 || *endp !=0 )return CMD_RET_USAGE ; ret =cros_ec_set_ldo (dev, index, state);
cmd/demo.c +1 -1
@@ -106,7 +106,7 @@ static int do_demo(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ;if (argc) { - devnum =simple_strtoul (argv[0 ],NULL ,10 ); + devnum =dectoul (argv[0 ],NULL ); ret =uclass_get_device (UCLASS_DEMO , devnum, &demo_dev);if (ret)return cmd_process_error (cmdtp, ret);
cmd/exit.c +1 -1
@@ -11,7 +11,7 @@ static int do_exit(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) {if (argc >1 ) -return simple_strtoul (argv[1 ],NULL ,10 ); +return dectoul (argv[1 ],NULL );return 0 ; }
cmd/flash.c +3 -3
@@ -57,7 +57,7 @@ abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)return 0 ; *p++ ='\0' ; - bank =simple_strtoul (str, &ep,10 ); + bank =dectoul (str, &ep);if (ep == str || *ep !='\0' || bank <1 || bank >CONFIG_SYS_MAX_FLASH_BANKS || (fp = &flash_info[bank -1 ])->flash_id ==FLASH_UNKNOWN )
@@ -67,12 +67,12 @@ abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)if ((p =strchr (str,'-' )) !=NULL ) *p++ ='\0' ; - first =simple_strtoul (str, &ep,10 ); + first =dectoul (str, &ep);if (ep == str || *ep !='\0' || first >= fp->sector_count)return -1 ;if (p !=NULL ) { - last =simple_strtoul (p, &ep,10 ); + last =dectoul (p, &ep);if (ep == p || *ep !='\0' || last < first || last >= fp->sector_count)return -1 ;
cmd/gpio.c +2 -2
@@ -17,7 +17,7 @@__weak int name_to_gpio (const char *name) { -return simple_strtoul (name,NULL ,10 ); +return dectoul (name,NULL ); }enum gpio_cmd {
@@ -99,7 +99,7 @@ static int do_gpio_status(bool all, const char *gpio_name) p = gpio_name + banklen;if (gpio_name && *p) { - offset =simple_strtoul (p,NULL ,10 ); + offset =dectoul (p,NULL );gpio_get_description (dev, bank_name, offset, &flags, true); }else {
cmd/gpt.c +1 -1
@@ -985,7 +985,7 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])#endif return CMD_RET_USAGE ; - dev = (int )simple_strtoul (argv[3 ], &ep,10 ); + dev = (int )dectoul (argv[3 ], &ep);if (!ep || ep[0 ] !='\0' ) {printf ("'%s' is not a number\n" , argv[3 ]);return CMD_RET_USAGE ;
cmd/i2c.c +4 -4
@@ -1079,7 +1079,7 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,*/ delay =1000 ;if (argc >3 ) - delay =simple_strtoul (argv[4 ],NULL ,10 ); + delay =dectoul (argv[4 ],NULL );/* * Run the loop... */
@@ -1765,7 +1765,7 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,int i;/* show specific bus */ - i =simple_strtoul (argv[1 ],NULL ,10 ); + i =dectoul (argv[1 ],NULL );#if CONFIG_IS_ENABLED (DM_I2C )struct udevice *bus;int ret;
@@ -1833,7 +1833,7 @@ static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,#endif printf ("Current bus is %d\n" , bus_no); }else { - bus_no =simple_strtoul (argv[1 ],NULL ,10 ); + bus_no =dectoul (argv[1 ],NULL );#if defined(CONFIG_SYS_I2C )if (bus_no >=CONFIG_SYS_NUM_I2C_BUSES ) {printf ("Invalid bus %d\n" , bus_no);
@@ -1884,7 +1884,7 @@ static int do_i2c_bus_speed(struct cmd_tbl *cmdtp, int flag, int argc,/* querying current speed */ printf ("Current bus speed=%d\n" , speed); }else { - speed =simple_strtoul (argv[1 ],NULL ,10 ); + speed =dectoul (argv[1 ],NULL );printf ("Setting bus speed to %d Hz\n" , speed);#if CONFIG_IS_ENABLED (DM_I2C ) ret =dm_i2c_set_bus_speed (bus, speed);
cmd/led.c +1 -1
@@ -93,7 +93,7 @@ int do_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (cmd ==LEDST_BLINK ) {if (argc <4 )return CMD_RET_USAGE ; - freq_ms =simple_strtoul (argv[3 ],NULL ,10 ); + freq_ms =dectoul (argv[3 ],NULL ); }#endif ret =led_get_by_label (led_label, &dev);
cmd/legacy_led.c +1 -1
@@ -129,7 +129,7 @@ int do_legacy_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc !=4 )return CMD_RET_USAGE ; - freq =simple_strtoul (argv[3 ],NULL ,10 ); + freq =dectoul (argv[3 ],NULL );__led_blink (led_commands[i].mask, freq); }/* Need to set only 1 led if led_name wasn't 'all' */
cmd/load.c +3 -3
@@ -70,7 +70,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc, offset =simple_strtol (argv[1 ],NULL ,16 ); }if (argc ==3 ) { - load_baudrate = (int )simple_strtoul (argv[2 ],NULL ,10 ); + load_baudrate = (int )dectoul (argv[2 ],NULL );/* default to current baudrate */ if (load_baudrate ==0 )
@@ -264,7 +264,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc, size =hextoul (argv[2 ],NULL ); }if (argc ==4 ) { - save_baudrate = (int )simple_strtoul (argv[3 ],NULL ,10 ); + save_baudrate = (int )dectoul (argv[3 ],NULL );/* default to current baudrate */ if (save_baudrate ==0 )
@@ -446,7 +446,7 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc, offset =hextoul (argv[1 ],NULL ); }if (argc ==3 ) { - load_baudrate = (int )simple_strtoul (argv[2 ],NULL ,10 ); + load_baudrate = (int )dectoul (argv[2 ],NULL );/* default to current baudrate */ if (load_baudrate ==0 )
cmd/log.c +2 -2
@@ -352,7 +352,7 @@ static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <7 )return CMD_RET_USAGE ; cat =log_get_cat_by_name (argv[1 ]); - level =simple_strtoul (argv[2 ], &end,10 ); + level =dectoul (argv[2 ], &end);if (end == argv[2 ]) { level =log_get_level_by_name (argv[2 ]);
@@ -366,7 +366,7 @@ static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } file = argv[3 ]; - line =simple_strtoul (argv[4 ],NULL ,10 ); + line =dectoul (argv[4 ],NULL ); func = argv[5 ]; msg = argv[6 ];if (_log (cat, level, file, line, func,"%s\n" , msg))
cmd/mbr.c +1 -1
@@ -269,7 +269,7 @@ static int do_mbr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc !=4 && argc !=5 )return CMD_RET_USAGE ; - dev = (int )simple_strtoul (argv[3 ], &ep,10 ); + dev = (int )dectoul (argv[3 ], &ep);if (!ep || ep[0 ] !='\0' ) {printf ("'%s' is not a number\n" , argv[3 ]);return CMD_RET_USAGE ;
cmd/mem.c +2 -2
@@ -189,7 +189,7 @@ static int do_mem_mdc(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <4 )return CMD_RET_USAGE ; - count =simple_strtoul (argv[3 ],NULL ,10 ); + count =dectoul (argv[3 ],NULL );for (;;) {do_mem_md (NULL ,0 ,3 , argv);
@@ -217,7 +217,7 @@ static int do_mem_mwc(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <4 )return CMD_RET_USAGE ; - count =simple_strtoul (argv[3 ],NULL ,10 ); + count =dectoul (argv[3 ],NULL );for (;;) {do_mem_mw (NULL ,0 ,3 , argv);
cmd/mmc.c +20 -20
@@ -519,10 +519,10 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,if (argc ==1 ) { dev = curr_device; }else if (argc ==2 ) { - dev =simple_strtoul (argv[1 ],NULL ,10 ); + dev =dectoul (argv[1 ],NULL ); }else if (argc ==3 ) { - dev = (int )simple_strtoul (argv[1 ],NULL ,10 ); - part = (int )simple_strtoul (argv[2 ],NULL ,10 ); + dev = (int )dectoul (argv[1 ],NULL ); + part = (int )dectoul (argv[2 ],NULL );if (part >PART_ACCESS_MASK ) {printf ("#part_num shouldn't be larger than %d\n" ,PART_ACCESS_MASK );
@@ -572,9 +572,9 @@ static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,if (i +2 >= argc)return -1 ; pconf->user.enh_start = -simple_strtoul (argv[i+1 ],NULL ,10 ); +dectoul (argv[i +1 ],NULL ); pconf->user.enh_size = -simple_strtoul (argv[i+2 ],NULL ,10 ); +dectoul (argv[i +2 ],NULL ); i +=3 ; }else if (!strcmp (argv[i],"wrrel" )) {if (i +1 >= argc)
@@ -603,7 +603,7 @@ static int parse_hwpart_gp(struct mmc_hwpart_conf *pconf, int pidx,if (1 >= argc)return -1 ; - pconf->gp_part[pidx].size =simple_strtoul (argv[0 ],NULL ,10 ); + pconf->gp_part[pidx].size =dectoul (argv[0 ],NULL ); i =1 ;while (i < argc) {
@@ -721,10 +721,10 @@ static int do_mmc_bootbus(struct cmd_tbl *cmdtp, int flag,if (argc !=5 )return CMD_RET_USAGE ; - dev =simple_strtoul (argv[1 ],NULL ,10 ); - width =simple_strtoul (argv[2 ],NULL ,10 ); - reset =simple_strtoul (argv[3 ],NULL ,10 ); - mode =simple_strtoul (argv[4 ],NULL ,10 ); + dev =dectoul (argv[1 ],NULL ); + width =dectoul (argv[2 ],NULL ); + reset =dectoul (argv[3 ],NULL ); + mode =dectoul (argv[4 ],NULL ); mmc =init_mmc_device (dev, false);if (!mmc)
@@ -785,9 +785,9 @@ static int do_mmc_boot_resize(struct cmd_tbl *cmdtp, int flag,if (argc !=4 )return CMD_RET_USAGE ; - dev =simple_strtoul (argv[1 ],NULL ,10 ); - bootsize =simple_strtoul (argv[2 ],NULL ,10 ); - rpmbsize =simple_strtoul (argv[3 ],NULL ,10 ); + dev =dectoul (argv[1 ],NULL ); + bootsize =dectoul (argv[2 ],NULL ); + rpmbsize =dectoul (argv[3 ],NULL ); mmc =init_mmc_device (dev, false);if (!mmc)
@@ -842,7 +842,7 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,if (argc !=2 && argc !=3 && argc !=5 )return CMD_RET_USAGE ; - dev =simple_strtoul (argv[1 ],NULL ,10 ); + dev =dectoul (argv[1 ],NULL ); mmc =init_mmc_device (dev, false);if (!mmc)
@@ -856,9 +856,9 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,if (argc ==2 || argc ==3 )return mmc_partconf_print (mmc, argc ==3 ? argv[2 ] :NULL ); - ack =simple_strtoul (argv[2 ],NULL ,10 ); - part_num =simple_strtoul (argv[3 ],NULL ,10 ); - access =simple_strtoul (argv[4 ],NULL ,10 ); + ack =dectoul (argv[2 ],NULL ); + part_num =dectoul (argv[3 ],NULL ); + access =dectoul (argv[4 ],NULL );/* acknowledge to be sent during boot operation */ return mmc_set_part_conf (mmc, ack, part_num, access);
@@ -879,8 +879,8 @@ static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag,if (argc !=3 )return CMD_RET_USAGE ; - dev =simple_strtoul (argv[1 ],NULL ,10 ); - enable =simple_strtoul (argv[2 ],NULL ,10 ); + dev =dectoul (argv[1 ],NULL ); + enable =dectoul (argv[2 ],NULL );if (enable >2 ) {puts ("Invalid RST_n_ENABLE value\n" );
@@ -937,7 +937,7 @@ static int do_mmc_bkops_enable(struct cmd_tbl *cmdtp, int flag,if (argc !=2 )return CMD_RET_USAGE ; - dev =simple_strtoul (argv[1 ],NULL ,10 ); + dev =dectoul (argv[1 ],NULL ); mmc =init_mmc_device (dev, false);if (!mmc)
cmd/mp.c +1 -1
@@ -36,7 +36,7 @@ cpu_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc <3 )return CMD_RET_USAGE ; - cpuid =simple_strtoul (argv[1 ],NULL ,10 ); + cpuid =dectoul (argv[1 ],NULL );if (!is_core_valid (cpuid)) {printf ("Core num: %lu is not valid\n" , cpuid);return 1 ;
cmd/nand.c +1 -1
@@ -424,7 +424,7 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,return 0 ; } - dev = (int )simple_strtoul (argv[2 ],NULL ,10 ); + dev = (int )dectoul (argv[2 ],NULL );set_dev (dev);return 0 ;
cmd/nvedit.c +1 -1
@@ -423,7 +423,7 @@ int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])* the size. Otherwise we echo it as part of the * message. */ - i =simple_strtoul (argv[argc -1 ], &endptr,10 ); + i =dectoul (argv[argc -1 ], &endptr);if (*endptr !='\0' ) {/* no size */ size =CONFIG_SYS_CBSIZE -1 ; }else {/* size given */
cmd/optee_rpmb.c +1 -1
@@ -195,7 +195,7 @@ int do_optee_rpmb_read(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; name = argv[1 ]; - bytes =simple_strtoul (argv[2 ], &endp,10 ); + bytes =dectoul (argv[2 ], &endp);if (*endp && *endp !='\n' )return CMD_RET_USAGE ;
cmd/osd.c +2 -2
@@ -211,7 +211,7 @@ static int do_show_osd(struct cmd_tbl *cmdtp, int flag, int argc,int i, res;/* show specific OSD */ - i =simple_strtoul (argv[1 ],NULL ,10 ); + i =dectoul (argv[1 ],NULL ); res =uclass_get_device_by_seq (UCLASS_VIDEO_OSD , i, &osd);if (res) {
@@ -240,7 +240,7 @@ static int do_osd_num(struct cmd_tbl *cmdtp, int flag, int argc, osd_no =-1 ;printf ("Current osd is %d\n" , osd_no); }else { - osd_no =simple_strtoul (argv[1 ],NULL ,10 ); + osd_no =dectoul (argv[1 ],NULL );printf ("Setting osd to %d\n" , osd_no); res =cmd_osd_set_osd_num (osd_no);
cmd/pcap.c +1 -1
@@ -19,7 +19,7 @@ static int do_pcap_init(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; addr =hextoul (argv[1 ],NULL ); - size =simple_strtoul (argv[2 ],NULL ,10 ); + size =dectoul (argv[2 ],NULL );return pcap_init (addr, size) ?CMD_RET_FAILURE :CMD_RET_SUCCESS ; }
cmd/pstore.c +1 -1
@@ -279,7 +279,7 @@ static int pstore_display(struct cmd_tbl *cmdtp, int flag, int argc, - pstore_ftrace_size - pstore_console_size;if (argc >2 ) { - ptr +=simple_strtoul (argv[2 ],NULL ,10 ) + ptr +=dectoul (argv[2 ],NULL ) * pstore_record_size; ptr_end = ptr + pstore_record_size; }
cmd/pwm.c +5 -5
@@ -66,7 +66,7 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_USAGE ; } - pwm_dev =simple_strtoul (str_pwm,NULL ,10 ); + pwm_dev =dectoul (str_pwm,NULL ); ret =uclass_get_device (UCLASS_PWM , pwm_dev, &dev);if (ret) {printf ("pwm: '%s' not found\n" , str_pwm);
@@ -74,22 +74,22 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc, } str_channel = *argv; - channel =simple_strtoul (str_channel,NULL ,10 ); + channel =dectoul (str_channel,NULL ); argc--; argv++;if (sub_cmd ==PWM_SET_INVERT ) { str_enable = *argv; - pwm_enable =simple_strtoul (str_enable,NULL ,10 ); + pwm_enable =dectoul (str_enable,NULL ); ret =pwm_set_invert (dev, channel, pwm_enable); }else if (sub_cmd ==PWM_SET_CONFIG ) { str_period = *argv; argc--; argv++; - period_ns =simple_strtoul (str_period,NULL ,10 ); + period_ns =dectoul (str_period,NULL ); str_duty = *argv; - duty_ns =simple_strtoul (str_duty,NULL ,10 ); + duty_ns =dectoul (str_duty,NULL ); ret =pwm_set_config (dev, channel, period_ns, duty_ns); }else if (sub_cmd ==PWM_SET_ENABLE ) {
cmd/remoteproc.c +3 -3
@@ -84,7 +84,7 @@ static int do_rproc_init(struct cmd_tbl *cmdtp, int flag, int argc,return 0 ;printf ("Few Remote Processors failed to be initialized\n" ); }else if (argc ==2 ) { - id = (int )simple_strtoul (argv[1 ],NULL ,10 ); + id = (int )dectoul (argv[1 ],NULL );if (!rproc_dev_init (id))return 0 ;printf ("Remote Processor %d failed to be initialized\n" , id);
@@ -129,7 +129,7 @@ static int do_remoteproc_load(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=4 )return CMD_RET_USAGE ; - id = (int )simple_strtoul (argv[1 ],NULL ,10 ); + id = (int )dectoul (argv[1 ],NULL ); addr =hextoul (argv[2 ],NULL ); size =hextoul (argv[3 ],NULL );
@@ -167,7 +167,7 @@ static int do_remoteproc_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=2 )return CMD_RET_USAGE ; - id = (int )simple_strtoul (argv[1 ],NULL ,10 ); + id = (int )dectoul (argv[1 ],NULL );if (!strcmp (argv[0 ],"start" )) { ret =rproc_start (id);
cmd/rtc.c +1 -1
@@ -130,7 +130,7 @@ int do_rtc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) idx = curr_rtc;if (!strcmp (argv[0 ],"dev" ) && argc >=2 ) - idx =simple_strtoul (argv[1 ],NULL ,10 ); + idx =dectoul (argv[1 ],NULL ); ret =uclass_get_device (UCLASS_RTC , idx, &dev);if (ret) {
cmd/sata.c +1 -1
@@ -88,7 +88,7 @@ static int do_sata(struct cmd_tbl *cmdtp, int flag, int argc,int devnum =0 ;if (argc ==3 ) - devnum = (int )simple_strtoul (argv[2 ],NULL ,10 ); + devnum = (int )dectoul (argv[2 ],NULL );if (!strcmp (argv[1 ],"stop" ))return sata_remove (devnum);
cmd/sleep.c +1 -1
@@ -20,7 +20,7 @@ static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=2 )return CMD_RET_USAGE ; - delay =simple_strtoul (argv[1 ],NULL ,10 ) *CONFIG_SYS_HZ ; + delay =dectoul (argv[1 ],NULL ) *CONFIG_SYS_HZ ; frpart =strchr (argv[1 ],'.' );
cmd/sound.c +2 -2
@@ -41,9 +41,9 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int argc,int freq =400 ;if (argc >1 ) - msec =simple_strtoul (argv[1 ],NULL ,10 ); + msec =dectoul (argv[1 ],NULL );if (argc >2 ) - freq =simple_strtoul (argv[2 ],NULL ,10 ); + freq =dectoul (argv[2 ],NULL ); ret =uclass_first_device_err (UCLASS_SOUND , &dev);if (!ret)
cmd/spi.c +5 -5
@@ -114,20 +114,20 @@ int do_spi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) {if (argc >=2 ) { mode =CONFIG_DEFAULT_SPI_MODE ; - bus =simple_strtoul (argv[1 ], &cp,10 ); + bus =dectoul (argv[1 ], &cp);if (*cp ==':' ) { - cs =simple_strtoul (cp+1 , &cp,10 ); + cs =dectoul (cp +1 , &cp); }else { cs = bus; bus =CONFIG_DEFAULT_SPI_BUS ; }if (*cp =='.' ) - mode =simple_strtoul (cp+1 , &cp,10 ); + mode =dectoul (cp +1 , &cp);if (*cp =='@' ) - freq =simple_strtoul (cp+1 , &cp,10 ); + freq =dectoul (cp +1 , &cp); }if (argc >=3 ) - bitlen =simple_strtoul (argv[2 ],NULL ,10 ); + bitlen =dectoul (argv[2 ],NULL );if (argc >=4 ) { cp = argv[3 ];for (j =0 ; *cp; j++, cp++) {
cmd/ti/pd.c +2 -2
@@ -119,8 +119,8 @@ static int do_pd_endis(int argc, char *const argv[], u8 state)if (!data)return CMD_RET_FAILURE ; - psc_id =simple_strtoul (argv[1 ],NULL ,10 ); - lpsc_id =simple_strtoul (argv[2 ],NULL ,10 ); + psc_id =dectoul (argv[1 ],NULL ); + lpsc_id =dectoul (argv[2 ],NULL );for (i =0 ; i < data->num_lpsc; i++) { lpsc = &data->lpsc[i];
cmd/tpm-common.c +1 -1
@@ -302,7 +302,7 @@ int do_tpm_device(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])int rc;if (argc ==2 ) { - num =simple_strtoul (argv[1 ],NULL ,10 ); + num =dectoul (argv[1 ],NULL ); rc =tpm_set_device (num);if (rc)
cmd/ufs.c +1 -1
@@ -16,7 +16,7 @@ static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (argc >=2 ) {if (!strcmp (argv[1 ],"init" )) {if (argc ==3 ) { - dev =simple_strtoul (argv[2 ],NULL ,10 ); + dev =dectoul (argv[2 ],NULL ); ret =ufs_probe_dev (dev);if (ret)return CMD_RET_FAILURE ;
cmd/usb.c +3 -3
@@ -690,7 +690,7 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])* have multiple controllers and the device numbering * starts at 1 on each bus. */ - i =simple_strtoul (argv[2 ],NULL ,10 ); + i =dectoul (argv[2 ],NULL );printf ("config for device %d\n" , i); udev =usb_find_device (i);if (udev ==NULL ) {
@@ -706,13 +706,13 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (strncmp (argv[1 ],"test" ,4 ) ==0 ) {if (argc <5 )return CMD_RET_USAGE ; - i =simple_strtoul (argv[2 ],NULL ,10 ); + i =dectoul (argv[2 ],NULL ); udev =usb_find_device (i);if (udev ==NULL ) {printf ("Device %d does not exist.\n" , i);return 1 ; } - i =simple_strtoul (argv[3 ],NULL ,10 ); + i =dectoul (argv[3 ],NULL );return usb_test (udev, i, argv[4 ]); }#ifdef CONFIG_USB_STORAGE
cmd/w1.c +4 -4
@@ -51,16 +51,16 @@ static int w1_read(int argc, char *const argv[])u8 buf[512 ];if (argc >2 ) - bus_n =simple_strtoul (argv[2 ],NULL ,10 ); + bus_n =dectoul (argv[2 ],NULL );if (argc >3 ) - dev_n =simple_strtoul (argv[3 ],NULL ,10 ); + dev_n =dectoul (argv[3 ],NULL );if (argc >4 ) - offset =simple_strtoul (argv[4 ],NULL ,10 ); + offset =dectoul (argv[4 ],NULL );if (argc >5 ) - len =simple_strtoul (argv[5 ],NULL ,10 ); + len =dectoul (argv[5 ],NULL );if (len >512 ) {printf ("len needs to be <= 512\n" );
common/bedbug.c +1 -1
@@ -1007,7 +1007,7 @@ long read_number (char *txt)if (txt[0 ] =='0' && (txt[1 ] =='x' || txt[1 ] =='X' ))/* hex */ val =hextoul (&txt[2 ],NULL );else /* decimal */ - val =simple_strtoul (txt,NULL ,10 ); + val =dectoul (txt,NULL );if (is_neg) val = -val;
common/lcd_console.c +2 -2
@@ -229,8 +229,8 @@ static int do_lcd_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,if (argc !=3 )return CMD_RET_USAGE ; - col =simple_strtoul (argv[1 ],NULL ,10 ); - row =simple_strtoul (argv[2 ],NULL ,10 ); + col =dectoul (argv[1 ],NULL ); + row =dectoul (argv[2 ],NULL );lcd_position_cursor (col, row);return 0 ;
disk/part_amiga.c +2 -2
@@ -135,7 +135,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc) s =env_get ("amiga_scanlimit" );if (s) - limit =simple_strtoul (s,NULL ,10 ); + limit =dectoul (s,NULL );else limit =AMIGA_BLOCK_LIMIT ;
@@ -175,7 +175,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc) s =env_get ("amiga_scanlimit" );if (s) - limit =simple_strtoul (s,NULL ,10 ); + limit =dectoul (s,NULL );else limit =AMIGA_BLOCK_LIMIT ;
drivers/dfu/dfu_mmc.c +1 -1
@@ -348,7 +348,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)const char *argv[3 ];const char **parg = argv; - dfu->data.mmc.dev_num =simple_strtoul (devstr,NULL ,10 ); + dfu->data.mmc.dev_num =dectoul (devstr,NULL );for (; parg < argv +sizeof (argv) /sizeof (*argv); ++parg) { *parg =strsep (&s," " );
drivers/dfu/dfu_mtd.c +1 -1
@@ -279,7 +279,7 @@ int dfu_fill_entity_mtd(struct dfu_entity *dfu, char *devstr, char *s) dfu->layout =DFU_RAW_ADDR ; - part =simple_strtoul (s, &s,10 ); + part =dectoul (s, &s);sprintf (mtd_id,"%s,%d" , devstr, part -1 );printf ("using id '%s'\n" , mtd_id);
drivers/dfu/dfu_nand.c +2 -2
@@ -215,9 +215,9 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s) dfu->layout =DFU_RAW_ADDR ; - dev =simple_strtoul (s, &s,10 ); + dev =dectoul (s, &s); s++; - part =simple_strtoul (s, &s,10 ); + part =dectoul (s, &s);sprintf (mtd_id,"%s%d,%d" ,"nand" , dev, part -1 );debug ("using id '%s'\n" , mtd_id);
drivers/dfu/dfu_sf.c +2 -2
@@ -184,9 +184,9 @@ int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s) dfu->layout =DFU_RAW_ADDR ; - dev =simple_strtoul (s, &s,10 ); + dev =dectoul (s, &s); s++; - part =simple_strtoul (s, &s,10 ); + part =dectoul (s, &s);sprintf (mtd_id,"%s%d,%d" ,"nor" , dev, part -1 );printf ("using id '%s'\n" , mtd_id);
drivers/dfu/dfu_virt.c +1 -1
@@ -38,7 +38,7 @@ int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, char *s) dfu->dev_type =DFU_DEV_VIRT ; dfu->layout =DFU_RAW_ADDR ; - dfu->data.virt.dev_num =simple_strtoul (devstr,NULL ,10 ); + dfu->data.virt.dev_num =dectoul (devstr,NULL ); dfu->write_medium = dfu_write_medium_virt; dfu->get_medium_size = dfu_get_medium_size_virt;
drivers/gpio/gpio-uclass.c +1 -1
@@ -122,7 +122,7 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc)int numeric;int ret; - numeric =isdigit (*name) ?simple_strtoul (name,NULL ,10 ) :-1 ; + numeric =isdigit (*name) ?dectoul (name,NULL ) :-1 ;for (ret =uclass_first_device (UCLASS_GPIO , &dev); dev; ret =uclass_next_device (&dev)) {
drivers/gpio/mxs_gpio.c +2 -2
@@ -123,12 +123,12 @@ int name_to_gpio(const char *name)unsigned bank, pin;char *end; - bank =simple_strtoul (name, &end,10 ); + bank =dectoul (name, &end);if (!*end || *end !=':' )return bank; - pin =simple_strtoul (end +1 ,NULL ,10 ); + pin =dectoul (end +1 ,NULL );return (bank <<MXS_PAD_BANK_SHIFT ) | (pin <<MXS_PAD_PIN_SHIFT ); }
drivers/gpio/tca642x.c +2 -2
@@ -262,11 +262,11 @@ static int do_tca642x(struct cmd_tbl *cmdtp, int flag, int argc,/* arg2 used as chip number or pin number */ if (argc >2 ) - ul_arg2 =simple_strtoul (argv[2 ],NULL ,10 ); + ul_arg2 =dectoul (argv[2 ],NULL );/* arg3 used as pin or invert value */ if (argc >3 ) - ul_arg3 =simple_strtoul (argv[3 ],NULL ,10 ) &0x1 ; + ul_arg3 =dectoul (argv[3 ],NULL ) &0x1 ;switch ((int )c->cmd) {case TCA642X_CMD_INFO :
drivers/net/e1000.c +1 -1
@@ -5796,7 +5796,7 @@ static int do_e1000(struct cmd_tbl *cmdtp, int flag, int argc, }/* Make sure we can find the requested e1000 card */ - cardnum =simple_strtoul (argv[1 ],NULL ,10 ); + cardnum =dectoul (argv[1 ],NULL );#ifdef CONFIG_DM_ETH e1000_name (name, cardnum); ret =uclass_get_device_by_name (UCLASS_ETH , name, &dev);
drivers/net/fsl-mc/mc.c +1 -1
@@ -642,7 +642,7 @@ static unsigned long get_mc_boot_timeout_ms(void)char *timeout_ms_env_var =env_get (MC_BOOT_TIMEOUT_ENV_VAR );if (timeout_ms_env_var) { - timeout_ms =simple_strtoul (timeout_ms_env_var,NULL ,10 ); + timeout_ms =dectoul (timeout_ms_env_var,NULL );if (timeout_ms ==0 ) {printf ("fsl-mc: WARNING: Invalid value for \'" MC_BOOT_TIMEOUT_ENV_VAR
drivers/net/netconsole.c +3 -3
@@ -87,7 +87,7 @@ static int refresh_settings_from_env(void)return -1 ;/* ncip is 0.0.0.0 */ p =strchr (env_get ("ncip" ),':' );if (p !=NULL ) { - nc_out_port =simple_strtoul (p +1 ,NULL ,10 ); + nc_out_port =dectoul (p +1 ,NULL ); nc_in_port = nc_out_port; } }else {
@@ -96,10 +96,10 @@ static int refresh_settings_from_env(void) p =env_get ("ncoutport" );if (p !=NULL ) - nc_out_port =simple_strtoul (p,NULL ,10 ); + nc_out_port =dectoul (p,NULL ); p =env_get ("ncinport" );if (p !=NULL ) - nc_in_port =simple_strtoul (p,NULL ,10 ); + nc_in_port =dectoul (p,NULL );if (is_broadcast (nc_ip))/* broadcast MAC address */
drivers/net/pfe_eth/pfe_firmware.c +1 -1
@@ -298,7 +298,7 @@ int pfe_firmware_init(void)if (!p) { max_fw_count =2 ; }else { - max_fw_count =simple_strtoul (p,NULL ,10 ); + max_fw_count =dectoul (p,NULL );if (max_fw_count) max_fw_count =3 ;else
drivers/net/phy/b53.c +2 -2
@@ -648,7 +648,7 @@ int do_b53_reg_read(const char *name, int argc, char *const argv[]) page =hextoul (argv[1 ],NULL ); offset =hextoul (argv[2 ],NULL ); - width =simple_strtoul (argv[3 ],NULL ,10 ); + width =dectoul (argv[3 ],NULL );switch (width) {case 8 :
@@ -700,7 +700,7 @@ int do_b53_reg_write(const char *name, int argc, char *const argv[]) page =hextoul (argv[1 ],NULL ); offset =hextoul (argv[2 ],NULL ); - width =simple_strtoul (argv[3 ],NULL ,10 ); + width =dectoul (argv[3 ],NULL );if (width ==48 || width ==64 ) value64 =simple_strtoull (argv[4 ],NULL ,16 );else
drivers/net/phy/mv88e6352.c +6 -6
@@ -238,9 +238,9 @@ int do_mvsw_reg_read(const char *name, int argc, char *const argv[])u16 value =0 , phyaddr, reg, port;int ret; - phyaddr =simple_strtoul (argv[1 ],NULL ,10 ); - port =simple_strtoul (argv[2 ],NULL ,10 ); - reg =simple_strtoul (argv[3 ],NULL ,10 ); + phyaddr =dectoul (argv[1 ],NULL ); + port =dectoul (argv[2 ],NULL ); + reg =dectoul (argv[3 ],NULL ); ret =sw_reg_read (name, phyaddr, port, reg, &value);printf ("%#x\n" , value);
@@ -253,9 +253,9 @@ int do_mvsw_reg_write(const char *name, int argc, char *const argv[])u16 value =0 , phyaddr, reg, port;int ret; - phyaddr =simple_strtoul (argv[1 ],NULL ,10 ); - port =simple_strtoul (argv[2 ],NULL ,10 ); - reg =simple_strtoul (argv[3 ],NULL ,10 ); + phyaddr =dectoul (argv[1 ],NULL ); + port =dectoul (argv[2 ],NULL ); + reg =dectoul (argv[3 ],NULL ); value =hextoul (argv[4 ],NULL ); ret =sw_reg_write (name, phyaddr, port, reg, value);
drivers/net/qe/dm_qe_uec.c +2 -2
@@ -938,7 +938,7 @@ enum qe_clock qe_clock_source(const char *source)return QE_CLK_NONE ;if (strncasecmp (source,"brg" ,3 ) ==0 ) { - i =simple_strtoul (source +3 ,NULL ,10 ); + i =dectoul (source +3 ,NULL );if (i >=1 && i <=16 )return (QE_BRG1 -1 ) + i;else
@@ -946,7 +946,7 @@ enum qe_clock qe_clock_source(const char *source) }if (strncasecmp (source,"clk" ,3 ) ==0 ) { - i =simple_strtoul (source +3 ,NULL ,10 ); + i =dectoul (source +3 ,NULL );if (i >=1 && i <=24 )return (QE_CLK1 -1 ) + i;else
drivers/pinctrl/nexell/pinctrl-nexell.c +1 -1
@@ -34,7 +34,7 @@ unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name, idx++; } bank[idx] ='\0' ; - *pin = (u32 )simple_strtoul (&pin_name[++idx],NULL ,10 ); + *pin = (u32 )dectoul (&pin_name[++idx],NULL );/* lookup the pin bank data using the pin bank name */ for (idx =0 ; idx < nr_banks; idx++)
drivers/pinctrl/pinctrl-uclass.c +1 -1
@@ -69,7 +69,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)* If statename is not found in "pinctrl-names", * assume statename is just the integer state ID. */ - state =simple_strtoul (statename, &end,10 ); + state =dectoul (statename, &end);if (*end)return -EINVAL ; }
drivers/ram/octeon/octeon_ddr.c +1 -1
@@ -2544,7 +2544,7 @@ try_again: eptr =env_get ("limit_dram_mbytes" );if (eptr) { -unsigned int mbytes =simple_strtoul (eptr,NULL ,10 ); +unsigned int mbytes =dectoul (eptr,NULL );if (mbytes >0 ) { memsize_mbytes = mbytes;
drivers/serial/serial-uclass.c +1 -1
@@ -395,7 +395,7 @@ static int on_baudrate(const char *name, const char *value, enum env_op op,/* * Switch to new baudrate if new baudrate is supported */ - baudrate =simple_strtoul (value,NULL ,10 ); + baudrate =dectoul (value,NULL );/* Not actually changing */ if (gd->baudrate == baudrate)
drivers/serial/serial.c +1 -1
@@ -61,7 +61,7 @@ static int on_baudrate(const char *name, const char *value, enum env_op op,/* * Switch to new baudrate if new baudrate is supported */ - baudrate =simple_strtoul (value,NULL ,10 ); + baudrate =dectoul (value,NULL );/* Not actually changing */ if (gd->baudrate == baudrate)
drivers/usb/cdns3/gadget.c +1 -1
@@ -1659,7 +1659,7 @@ cdns3_endpoint *cdns3_find_available_ep(struct cdns3_device *priv_dev,/* ep name pattern likes epXin or epXout */ char c[2 ] = {ep->name[2 ],'\0' }; - num =simple_strtoul (c,NULL ,10 ); + num =dectoul (c,NULL ); priv_ep =ep_to_cdns3_ep (ep);if (cdns3_ep_dir_is_correct (desc, priv_ep)) {
drivers/usb/gadget/epautoconf.c +1 -1
@@ -144,7 +144,7 @@ static int ep_matches(/* report address */ if (isdigit (ep->name[2 ])) { -u8 num =simple_strtoul (&ep->name[2 ],NULL ,10 ); +u8 num =dectoul (&ep->name[2 ],NULL ); desc->bEndpointAddress |= num; #ifdef MANY_ENDPOINTS }else if (desc->bEndpointAddress &USB_DIR_IN ) {
drivers/usb/gadget/ether.c +1 -2
@@ -2401,8 +2401,7 @@ static int _usb_eth_init(struct ether_priv *priv)usb_gadget_connect (gadget);if (env_get ("cdc_connect_timeout" )) - timeout =simple_strtoul (env_get ("cdc_connect_timeout" ), -NULL ,10 ) *CONFIG_SYS_HZ ; + timeout =dectoul (env_get ("cdc_connect_timeout" ),NULL ) *CONFIG_SYS_HZ ; ts =get_timer (0 );while (!dev->network_started) {/* Handle control-c and timeouts */
drivers/video/vidconsole-uclass.c +2 -2
@@ -692,8 +692,8 @@ static int do_video_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,if (uclass_first_device_err (UCLASS_VIDEO_CONSOLE , &dev))return CMD_RET_FAILURE ; - col =simple_strtoul (argv[1 ],NULL ,10 ); - row =simple_strtoul (argv[2 ],NULL ,10 ); + col =dectoul (argv[1 ],NULL ); + row =dectoul (argv[2 ],NULL );vidconsole_position_cursor (dev, col, row);return 0 ;
examples/standalone/atmel_df_pow2.c +3 -2
@@ -141,11 +141,12 @@ int atmel_df_pow2(int argc, char *const argv[])if (line[0 ] =='\0' )continue ; - bus = cs =simple_strtoul (line, &p,10 ); + bus =dectoul (line, &p); + cs = bus;if (*p) {if (*p ==':' ) { ++p; - cs =simple_strtoul (p, &p,10 ); + cs =dectoul (p, &p); }if (*p) {puts ("invalid format, please try again\n" );
include/vsprintf.h +13 -0
@@ -37,6 +37,19 @@ ulong simple_strtoul(const char *cp, char **endp, unsigned int base);*/ unsigned long hextoul (const char *cp,char **endp); +/** +* dec_strtoul - convert a string in decimal to an unsigned long +* +* @param cp The string to be converted +* @param endp Updated to point to the first character not converted +* @return value decoded from string (0 if invalid) +* +* Converts a decimal string to an unsigned long. If there are invalid +* characters at the end these are ignored. In the worst case, if all characters +* are invalid, 0 is returned +*/ +unsigned long dectoul (const char *cp,char **endp); +/** * strict_strtoul - convert a string to an unsigned long strictly * @param cp The string to be converted
lib/dhry/cmd_dhry.c +1 -1
@@ -16,7 +16,7 @@ static int do_dhry(struct cmd_tbl *cmdtp, int flag, int argc,int iterations =1000000 ;if (argc >1 ) - iterations =simple_strtoul (argv[1 ],NULL ,10 ); + iterations =dectoul (argv[1 ],NULL ); start =get_timer (0 );dhry (iterations);
lib/fdtdec.c +1 -1
@@ -405,7 +405,7 @@ int fdtdec_add_aliases_for_id(const void *blob, const char *name,continue ;/* Get the alias number */ - number =simple_strtoul (path + name_len,NULL ,10 ); + number =dectoul (path + name_len,NULL );if (number <0 || number >= maxcount) {debug ("%s: warning: alias '%s' is out of range\n" , __func__, path);
lib/net_utils.c +1 -1
@@ -23,7 +23,7 @@ struct in_addr string_to_ip(const char *s)return addr;for (addr.s_addr =0 , i =0 ; i <4 ; ++i) { -ulong val = s ?simple_strtoul (s, &e,10 ) :0 ; +ulong val = s ?dectoul (s, &e) :0 ;if (val >255 ) { addr.s_addr =0 ;return addr;
lib/strto.c +6 -1
@@ -54,6 +54,11 @@ ulong hextoul(const char *cp, char **endp)return simple_strtoul (cp, endp,16 ); } +ulong dectoul (const char *cp,char **endp) +{ +return simple_strtoul (cp, endp,10 ); +} +int strict_strtoul (const char *cp,unsigned int base,unsigned long *res) {char *tail;
@@ -156,7 +161,7 @@ long trailing_strtoln(const char *str, const char *end)if (isdigit (end[-1 ])) {for (p = end -1 ; p > str; p--) {if (!isdigit (*p)) -return simple_strtoul (p +1 ,NULL ,10 ); +return dectoul (p +1 ,NULL ); } }
net/bootp.c +1 -1
@@ -740,7 +740,7 @@ void bootp_request(void) ep =env_get ("bootpretryperiod" );if (ep !=NULL ) - time_taken_max =simple_strtoul (ep,NULL ,10 ); + time_taken_max =dectoul (ep,NULL );else time_taken_max =TIMEOUT_MS ;
net/eth-uclass.c +2 -2
@@ -128,7 +128,7 @@ struct udevice *eth_get_dev_by_name(const char *devname)/* Must be longer than 3 to be an alias */ if (!strncmp (devname,"eth" , len) &&strlen (devname) > len) { startp = devname + len; - seq =simple_strtoul (startp, &endp,10 ); + seq =dectoul (startp, &endp); } ret =uclass_get (UCLASS_ETH , &uc);
@@ -241,7 +241,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,struct udevice *dev;/* look for an index after "eth" */ - index =simple_strtoul (name +3 ,NULL ,10 ); + index =dectoul (name +3 ,NULL ); retval =uclass_find_device_by_seq (UCLASS_ETH , index, &dev);if (!retval) {
net/eth_legacy.c +1 -1
@@ -114,7 +114,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,return 0 ;/* look for an index after "eth" */ - index =simple_strtoul (name +3 ,NULL ,10 ); + index =dectoul (name +3 ,NULL ); dev = eth_devices; do {
net/net.c +1 -1
@@ -1591,7 +1591,7 @@ ushort string_to_vlan(const char *s)if (*s <'0' || *s >'9' ) id =VLAN_NONE ;else - id = (ushort )simple_strtoul (s,NULL ,10 ); + id = (ushort )dectoul (s,NULL );return htons (id); }
net/tftp.c +5 -8
@@ -554,8 +554,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,for (i =0 ; i+8 < len; i++) {if (strcasecmp ((char *)pkt + i,"blksize" ) ==0 ) { tftp_block_size = (unsigned short ) -simple_strtoul ((char *)pkt + i +8 , -NULL ,10 ); +dectoul ((char *)pkt + i +8 ,NULL );debug ("Blocksize oack: %s, %d\n" , (char *)pkt + i +8 , tftp_block_size);if (tftp_block_size > tftp_block_size_option) {
@@ -566,8 +565,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip, }if (strcasecmp ((char *)pkt + i,"timeout" ) ==0 ) { timeout_val_rcvd = (unsigned short ) -simple_strtoul ((char *)pkt + i +8 , -NULL ,10 ); +dectoul ((char *)pkt + i +8 ,NULL );debug ("Timeout oack: %s, %d\n" , (char *)pkt + i +8 , timeout_val_rcvd);if (timeout_val_rcvd != (timeout_ms /1000 )) {
@@ -578,16 +576,15 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip, }#ifdef CONFIG_TFTP_TSIZE if (strcasecmp ((char *)pkt + i,"tsize" ) ==0 ) { - tftp_tsize =simple_strtoul ((char *)pkt + i +6 , -NULL ,10 ); + tftp_tsize =dectoul ((char *)pkt + i +6 , +NULL );debug ("size = %s, %d\n" , (char *)pkt + i +6 , tftp_tsize); }#endif if (strcasecmp ((char *)pkt + i,"windowsize" ) ==0 ) { tftp_windowsize = -simple_strtoul ((char *)pkt + i +11 , -NULL ,10 ); +dectoul ((char *)pkt + i +11 ,NULL );debug ("windowsize = %s, %d\n" , (char *)pkt + i +11 , tftp_windowsize); }
test/str_ut.c +12 -0
@@ -117,6 +117,18 @@ static int str_hextoul(struct unit_test_state *uts) }STR_TEST (str_hextoul,0 ); +static int str_dectoul (struct unit_test_state *uts) +{ +char *endp; + +/* Just a simple test, since we know this uses simple_strtoul() */ +ut_asserteq (1099 ,dectoul (str2, &endp)); +ut_asserteq (4 , endp - str2); + +return 0 ; +} +STR_TEST (str_dectoul,0 ); +int do_ut_str (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {struct unit_test *tests =UNIT_TEST_SUITE_START (str_test);
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 03/14] global: Convert simple_strtoul() with decimal to dectoul()
Quoted 4 lines · Simon Glass
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 <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 4/14 lib: Comment the base parameter with simple_strtoul/l()
In reply to Simon GlassThis parameter is not documented properly since it does not cover the meaning when the base is 0. Update this in both functions.
---
(no changes since v1)
include/vsprintf.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/vsprintf.h +8 -2
@@ -15,12 +15,15 @@* * @param cp The string to be converted * @param endp Updated to point to the first character not converted -* @param base The number base to use +* @param base The number base to use (0 for the default) * @return value decoded from string (0 if invalid) * * Converts a string to an unsigned long. If there are invalid characters at * the end these are ignored. In the worst case, if all characters are invalid, * 0 is returned +* +* If @base is 0, octal or hex prefixes are supported (e.g. 0777, 0x123) to +* select a particular base. By default decimal is used. */ ulong simple_strtoul (const char *cp,char **endp,unsigned int base);
@@ -53,7 +56,7 @@ unsigned long dectoul(const char *cp, char **endp);/** * strict_strtoul - convert a string to an unsigned long strictly * @param cp The string to be converted -* @param base The number base to use +* @param base The number base to use (0 for the default) * @param res The converted result value * @return 0 if conversion is successful and *res is set to the converted * value, otherwise it returns -EINVAL and *res is set to 0.
@@ -68,6 +71,9 @@ unsigned long dectoul(const char *cp, char **endp);* * echo will append a newline to the tail. * +* If @base is 0, octal or hex prefixes are supported (e.g. 0777, 0x123) to +* select a particular base. By default decimal is used. +* * Copied this function from Linux 2.6.38 commit ID: * 521cb40b0c44418a4fd36dc633f575813d59a43d *
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 04/14] lib: Comment the base parameter with simple_strtoul/l()
Quoted 4 lines · Simon Glass
This parameter is not documented properly since it does not cover the meaning when the base is 0. Update this in both functions.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 5/14 lib: Drop unnecessary check for hex digit
In reply to Simon GlassIf we see 0x then we can assume this is the start of a hex value. It does not seem necessary to check for a hex digit after that since it will happen when parsing the value anyway.
Drop this check to simplify the code and reduce size. Add a few more test cases for when a 0x prefix is used.
---
(no changes since v1)
lib/strto.c | 2 +- test/str_ut.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
lib/strto.c +1 -1
@@ -18,7 +18,7 @@ static const char *_parse_integer_fixup_radix(const char *s, unsigned int *base) {if (*base ==0 ) {if (s[0 ] =='0' ) { -if (tolower (s[1 ]) =='x' &&isxdigit (s[2 ])) +if (tolower (s[1 ]) =='x' ) *base =16 ;else *base =8 ;
test/str_ut.c +2 -0
@@ -84,6 +84,8 @@ static int str_simple_strtoul(struct unit_test_state *uts)/* Base 10 and base 16 */ ut_assertok (run_strtoul (uts, str2,10 ,1099 ,4 , upper));ut_assertok (run_strtoul (uts, str2,16 ,0x1099ab ,6 , upper)); +ut_assertok (run_strtoul (uts, str3,16 ,0xb ,3 , upper)); +ut_assertok (run_strtoul (uts, str3,10 ,0 ,1 , upper));/* Invalid string */ ut_assertok (run_strtoul (uts, str1,10 ,0 ,0 , upper));
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 05/14] lib: Drop unnecessary check for hex digit
Quoted 8 lines · Simon Glass
If we see 0x then we can assume this is the start of a hex value. It does not seem necessary to check for a hex digit after that since it will happen when parsing the value anyway.
Drop this check to simplify the code and reduce size. Add a few more test cases for when a 0x prefix is used.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 6/14 lib: Add tests for simple_strtoull()
In reply to Simon GlassAdd some tests that check the behaviour of this function. These are the same as for simple_strtoul() but with a few longer values.
---
(no changes since v1)
test/str_ut.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
test/str_ut.c +61 -0
@@ -15,6 +15,8 @@static const char str1[] ="I'm sorry I'm late." ;static const char str2[] ="1099abNo, don't bother apologising." ;static const char str3[] ="0xbI'm sorry you're alive." ; +static const char str4[] ="1234567890123 I lost closer friends" ; +static const char str5[] ="0x9876543210the last time I was deloused" ;/* Declare a new str test */ #define STR_TEST (_name, _flags) UNIT_TEST(_name, _flags, str_test)
@@ -107,6 +109,65 @@ static int str_simple_strtoul(struct unit_test_state *uts) }STR_TEST (str_simple_strtoul,0 ); +static int run_strtoull (struct unit_test_state *uts,const char *str,int base, +unsigned long long expect_val,int expect_endp_offset, +bool upper) +{ +char out[TEST_STR_SIZE ]; +char *endp; +unsigned long long val; + +strcpy (out, str); +if (upper) +str_to_upper (out, out,-1 ); + + val =simple_strtoull (out, &endp, base); +ut_asserteq (expect_val, val); +ut_asserteq (expect_endp_offset, endp - out); + +return 0 ; +} + +static int str_simple_strtoull (struct unit_test_state *uts) +{ +int upper; + +/* Check that it is case-insentive */ +for (upper =0 ; upper <2 ; upper++) { +/* Base 10 and base 16 */ +ut_assertok (run_strtoull (uts, str2,10 ,1099 ,4 , upper)); +ut_assertok (run_strtoull (uts, str2,16 ,0x1099ab ,6 , upper)); +ut_assertok (run_strtoull (uts, str3,16 ,0xb ,3 , upper)); +ut_assertok (run_strtoull (uts, str3,10 ,0 ,1 , upper)); + +/* Large values */ +ut_assertok (run_strtoull (uts, str4,10 ,1234567890123 ,13 , + upper)); +ut_assertok (run_strtoull (uts, str4,16 ,0x1234567890123 ,13 , + upper)); +ut_assertok (run_strtoull (uts, str5,0 ,0x9876543210 ,12 , + upper)); + +/* Invalid string */ +ut_assertok (run_strtoull (uts, str1,10 ,0 ,0 , upper)); + +/* Base 0 */ +ut_assertok (run_strtoull (uts, str1,0 ,0 ,0 , upper)); +ut_assertok (run_strtoull (uts, str2,0 ,1099 ,4 , upper)); +ut_assertok (run_strtoull (uts, str3,0 ,0xb ,3 , upper)); + +/* Base 2 */ +ut_assertok (run_strtoull (uts, str1,2 ,0 ,0 , upper)); +ut_assertok (run_strtoull (uts, str2,2 ,2 ,2 , upper)); + } + +/* Check endp being NULL */ +ut_asserteq (1099 ,simple_strtoull (str2,NULL ,0 )); + +return 0 ; +} +STR_TEST (str_simple_strtoull,0 ); +static int str_hextoul (struct unit_test_state *uts) {char *endp;
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 06/14] lib: Add tests for simple_strtoull()
Quoted 4 lines · Simon Glass
Add some tests that check the behaviour of this function. These are the same as for
simple_strtoul()but with a few longer values.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 7/14 lib: Add octal tests for simple_strtoul/l()
In reply to Simon GlassThis function support decoding octal but no tests are included yet. Add some.
---
(no changes since v1)
test/str_ut.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
test/str_ut.c +10 -0
@@ -17,6 +17,8 @@ static const char str2[] = "1099abNo, don't bother apologising.";static const char str3[] ="0xbI'm sorry you're alive." ;static const char str4[] ="1234567890123 I lost closer friends" ;static const char str5[] ="0x9876543210the last time I was deloused" ; +static const char str6[] ="0778octal is seldom used" ; +static const char str7[] ="707it is a piece of computing history" ;/* Declare a new str test */ #define STR_TEST (_name, _flags) UNIT_TEST(_name, _flags, str_test)
@@ -89,6 +91,10 @@ static int str_simple_strtoul(struct unit_test_state *uts)ut_assertok (run_strtoul (uts, str3,16 ,0xb ,3 , upper));ut_assertok (run_strtoul (uts, str3,10 ,0 ,1 , upper)); +/* Octal */ +ut_assertok (run_strtoul (uts, str6,0 ,63 ,3 , upper)); +ut_assertok (run_strtoul (uts, str7,8 ,0x1c7 ,3 , upper)); +/* Invalid string */ ut_assertok (run_strtoul (uts, str1,10 ,0 ,0 , upper));
@@ -140,6 +146,10 @@ static int str_simple_strtoull(struct unit_test_state *uts)ut_assertok (run_strtoull (uts, str3,16 ,0xb ,3 , upper));ut_assertok (run_strtoull (uts, str3,10 ,0 ,1 , upper)); +/* Octal */ +ut_assertok (run_strtoull (uts, str6,0 ,63 ,3 , upper)); +ut_assertok (run_strtoull (uts, str7,8 ,0x1c7 ,3 , upper)); +/* Large values */ ut_assertok (run_strtoull (uts, str4,10 ,1234567890123 ,13 , upper));
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 07/14] lib: Add octal tests for simple_strtoul/l()
Quoted 4 lines · Simon Glass
This function support decoding octal but no tests are included yet. Add some.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 8/14 lib: Move common digit-parsing code into a function
In reply to Simon GlassThe code to convert a character into a digit is repeated twice in this file. Factor it out into a separate function. This also makes the code a little easier to read.
---
(no changes since v1)
lib/strto.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
lib/strto.c +24 -7
@@ -30,16 +30,33 @@ static const char *_parse_integer_fixup_radix(const char *s, unsigned int *base)return s; } +/** +* decode_digit() - Decode a single character into its numeric digit value +* +* This ignore case +* +* @ch: Character to convert (expects '0'..'9', 'a'..'f' or 'A'..'F') +* @return value of digit (0..0xf) or 255 if the character is invalid +*/ +static uint decode_digit (int ch) +{ +if (!isxdigit (ch)) +return 256 ; + + ch =tolower (ch); + +return ch <='9' ? ch -'0' : ch -'a' +0xa ; +} +ulong simple_strtoul (const char *cp,char **endp,uint base) {ulong result =0 ; -ulong value; +uint value; cp =_parse_integer_fixup_radix (cp, &base); -while (isxdigit (*cp) && (value =isdigit (*cp) ? *cp-'0' : (islower (*cp) - ?toupper (*cp) : *cp)-'A' +10 ) < base) { - result = result*base + value; +while (value =decode_digit (*cp), value < base) { + result = result * base + value; cp++; }
@@ -136,12 +153,12 @@ unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base)unsigned long long simple_strtoull (const char *cp,char **endp,unsigned int base) { -unsigned long long result =0 , value; +unsigned long long result =0 ; +uint value; cp =_parse_integer_fixup_radix (cp, &base); -while (isxdigit (*cp) && (value =isdigit (*cp) ? *cp -'0' - : (islower (*cp) ?toupper (*cp) : *cp) -'A' +10 ) < base) { +while (value =decode_digit (*cp), value < base) { result = result * base + value; cp++; }
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 08/14] lib: Move common digit-parsing code into a function
Quoted 5 lines · Simon Glass
The code to convert a character into a digit is repeated twice in this file. Factor it out into a separate function. This also makes the code a little easier to read.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 9/14 doc: Convert command-line info to rST
In reply to Simon GlassTake this part of the README and put it into rST format.
---
Changes in v2:
- Add an SPDX header to the file too
README | 41 ------------------------------- doc/usage/cmdline.rst | 56 +++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + 3 files changed, 57 insertions(+), 41 deletions(-) create mode 100644 doc/usage/cmdline.rst
README +0 -41
@@ -3507,47 +3507,6 @@ The signature of the callback functions is: The return value is 0 if the variable change is accepted and 1 otherwise. -Command Line Parsing: -===================== - -There are two different command line parsers available with U-Boot: -the old "simple" one, and the much more powerful "hush" shell: - -Old, simple command line parser: --------------------------------- - -- supports environment variables (through setenv / saveenv commands) -- several commands on one line, separated by ';' -- variable substitution using "... ${name} ..." syntax -- special characters ('$', ';') can be escaped by prefixing with '\', - for example: - setenv bootcmd bootm \${address} -- You can also escape text by enclosing in single apostrophes, for example: - setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off' - -Hush shell: ------------ - -- similar to Bourne shell, with control structures like - if...then...else...fi, for...do...done; while...do...done, - until...do...done, ... -- supports environment ("global") variables (through setenv / saveenv - commands) and local shell variables (through standard shell syntax - "name=value"); only environment variables can be used with "run" - command - -General rules: --------------- - -(1) If a command line (or an environment variable executed by a "run" - command) contains several commands separated by semicolon, and - one of these commands fails, then the remaining commands will be - executed anyway. - -(2) If you execute several variables with one call to run (i. e. - calling run with a list of variables as arguments), any failing - command will cause "run" to terminate, i. e. the remaining - variables are not executed. Note for Redundant Ethernet Interfaces: =======================================
doc/usage/cmdline.rst new file +56 -0
56 lines not on this page · raw message
doc/usage/index.rst +1 -0
@@ -9,6 +9,7 @@ Use U-Boot fit netconsole partitions + cmdline Shell commands --------------
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 09/14] doc: Convert command-line info to rST
Quoted 3 lines · Simon Glass
Take this part of the README and put it into rST format.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 10/14 doc: Add a note about number representation
In reply to Simon GlassMention the default base of U-Boot in the command-line section. Add examples for decimal and octal.
---
(no changes since v1)
doc/usage/cmdline.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
doc/usage/cmdline.rst +31 -0
@@ -54,3 +54,34 @@ General rules calling run with a list of variables as arguments), any failing command will cause "run" to terminate, i. e. the remaining variables are not executed. + +Representing numbers +-------------------- + +Most U-Boot commands use hexadecimal (hex) as the default base, for convenient +use of addresses, for example:: + + => md 1000 6 + 00001000: 2c786f62 00697073 03000000 0c000000 box,spi......... + 00001010: 67020000 00000000 ...g.... + +There is no need to add a `0x` prefix to the arguments and the output is shown +in hex also, without any prefixes. This helps to avoid clutter. + +Some commands use decimal where it is more natural:: + + => i2c dev 0 + Setting bus to 0 + => i2c speed + Current bus speed=400000 + => i2c speed 100000 + Setting bus speed to 100000 Hz + +In some cases the default is decimal but it is possible to use octal if that is +useful:: + + pmic dev pmic@41 + dev: 1 @ pmic@41 + => pmic write 2 0177 + => pmic read 2 + 0x02: 0x00007f
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 10/14] doc: Add a note about number representation
Quoted 4 lines · Simon Glass
Mention the default base of U-Boot in the command-line section. Add examples for decimal and octal.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 11/14 lib: Allow using 0x when a decimal value is requested
In reply to Simon GlassU-Boot mostly uses hex for value input, largely because addresses are much easier to understand in hex.
But in some cases a decimal value is requested, such as where the value is small or hex does not make sense in the context. In these cases it is sometimes useful to be able to provide a hex value in any case, if only to resolve any ambiguity.
Add this functionality, for increased flexibility.
---
(no changes since v1)
doc/usage/cmdline.rst | 6 ++++++ include/vsprintf.h | 16 ++++++++++++---- lib/strto.c | 28 +++++++++++++++++----------- test/str_ut.c | 4 ++-- 4 files changed, 37 insertions(+), 17 deletions(-)
doc/usage/cmdline.rst +6 -0
@@ -85,3 +85,9 @@ useful:: => pmic write 2 0177 => pmic read 2 0x02: 0x00007f + +It is possible to use a `0x` prefix to use a hex value if that is more +convenient:: + + => i2c speed 0x30000 + Setting bus speed to 196608 Hz
include/vsprintf.h +12 -4
@@ -22,8 +22,12 @@* the end these are ignored. In the worst case, if all characters are invalid, * 0 is returned * -* If @base is 0, octal or hex prefixes are supported (e.g. 0777, 0x123) to -* select a particular base. By default decimal is used. +* A hex prefix is supported (e.g. 0x123) regardless of the value of @base. +* If found, the base is set to hex (16). +* +* If @base is 0: +* - an octal '0' prefix (e.g. 0777) sets the base to octal (8). +* - otherwise the base defaults to decimal (10). */ ulong simple_strtoul (const char *cp,char **endp,unsigned int base);
@@ -71,8 +75,12 @@ unsigned long dectoul(const char *cp, char **endp);* * echo will append a newline to the tail. * -* If @base is 0, octal or hex prefixes are supported (e.g. 0777, 0x123) to -* select a particular base. By default decimal is used. +* A hex prefix is supported (e.g. 0x123) regardless of the value of @base. +* If found, the base is set to hex (16). +* +* If @base is 0: +* - an octal '0' prefix (e.g. 0777) sets the base to octal (8). +* - otherwise the base defaults to decimal (10). * * Copied this function from Linux 2.6.38 commit ID: * 521cb40b0c44418a4fd36dc633f575813d59a43d
lib/strto.c +17 -11
@@ -14,19 +14,25 @@#include <linux/ctype.h> /* from lib/kstrtox.c */ -static const char *_parse_integer_fixup_radix (const char *s,unsigned int *base) +static const char *_parse_integer_fixup_radix (const char *s,uint *basep) { -if (*base ==0 ) { -if (s[0 ] =='0' ) { -if (tolower (s[1 ]) =='x' ) - *base =16 ; -else - *base =8 ; - }else - *base =10 ; +/* Look for a 0x prefix */ +if (s[0 ] =='0' ) { +int ch =tolower (s[1 ]); + +if (ch =='x' ) { + *basep =16 ; + s +=2 ; + }else if (!*basep) { +/* Only select octal if we don't have a base */ + *basep =8 ; + } } -if (*base ==16 && s[0 ] =='0' &&tolower (s[1 ]) =='x' ) - s +=2 ; + +/* Use decimal by default */ +if (!*basep) + *basep =10 ; +return s; }
test/str_ut.c +2 -2
@@ -89,7 +89,7 @@ static int str_simple_strtoul(struct unit_test_state *uts)ut_assertok (run_strtoul (uts, str2,10 ,1099 ,4 , upper));ut_assertok (run_strtoul (uts, str2,16 ,0x1099ab ,6 , upper));ut_assertok (run_strtoul (uts, str3,16 ,0xb ,3 , upper)); -ut_assertok (run_strtoul (uts, str3,10 ,0 ,1 , upper)); +ut_assertok (run_strtoul (uts, str3,10 ,0xb ,3 , upper));/* Octal */ ut_assertok (run_strtoul (uts, str6,0 ,63 ,3 , upper));
@@ -144,7 +144,7 @@ static int str_simple_strtoull(struct unit_test_state *uts)ut_assertok (run_strtoull (uts, str2,10 ,1099 ,4 , upper));ut_assertok (run_strtoull (uts, str2,16 ,0x1099ab ,6 , upper));ut_assertok (run_strtoull (uts, str3,16 ,0xb ,3 , upper)); -ut_assertok (run_strtoull (uts, str3,10 ,0 ,1 , upper)); +ut_assertok (run_strtoull (uts, str3,10 ,0xb ,3 , upper));/* Octal */ ut_assertok (run_strtoull (uts, str6,0 ,63 ,3 , upper));
Signature · 1 line
2.32.0.432.gabb21c7263-goog
Re: [PATCH v2 11/14] lib: Allow using 0x when a decimal value is requested
Quoted 11 lines · Simon Glass
U-Boot mostly uses hex for value input, largely because addresses are much easier to understand in hex.
But in some cases a decimal value is requested, such as where the value is small or hex does not make sense in the context. In these cases it is sometimes useful to be able to provide a hex value in any case, if only to resolve any ambiguity.
Add this functionality, for increased flexibility.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 12/14 lib: Support a decimal prefix 0n
In reply to Simon GlassU-Boot mostly uses hex for value input, largely because addresses are much easier to understand in hex.
However sometimes it is useful to be able to supply a decimal value when a hex value is expected.
Add this functionality, for increased flexibility.
---
Changes in v2:
- Use 0n instead for the decimal prefix
doc/usage/cmdline.rst | 7 +++++++ include/vsprintf.h | 6 ++++-- lib/strto.c | 3 +++ test/str_ut.c | 12 ++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-)
doc/usage/cmdline.rst +7 -0
@@ -65,6 +65,13 @@ use of addresses, for example:: 00001000: 2c786f62 00697073 03000000 0c000000 box,spi......... 00001010: 67020000 00000000 ...g.... +In these cases it is possible to use a `0n` prefix to use a decimal value if +that is more convenient. For example, this shows 19 bytes (0x13):: + + => md.b 1000 0n19 + 00001000: 62 6f 78 2c 73 70 69 00 00 00 00 03 00 00 00 0c box,spi......... + 00001010: 00 00 02 ... + There is no need to add a `0x` prefix to the arguments and the output is shown in hex also, without any prefixes. This helps to avoid clutter.
include/vsprintf.h +4 -2
@@ -23,7 +23,8 @@* 0 is returned * * A hex prefix is supported (e.g. 0x123) regardless of the value of @base. -* If found, the base is set to hex (16). +* If found, the base is set to hex (16). Similarly a decimal prefix (e.g. 0n12) +* causes the base to be set to decimal (10). * * If @base is 0: * - an octal '0' prefix (e.g. 0777) sets the base to octal (8).
@@ -76,7 +77,8 @@ unsigned long dectoul(const char *cp, char **endp);* echo will append a newline to the tail. * * A hex prefix is supported (e.g. 0x123) regardless of the value of @base. -* If found, the base is set to hex (16). +* If found, the base is set to hex (16). Similarly a decimal prefix (e.g. 0n12) +* causes the base to be set to decimal (10). * * If @base is 0: * - an octal '0' prefix (e.g. 0777) sets the base to octal (8).
lib/strto.c +3 -0
@@ -23,6 +23,9 @@ static const char *_parse_integer_fixup_radix(const char *s, uint *basep)if (ch =='x' ) { *basep =16 ; s +=2 ; + }else if (ch =='n' ) { + *basep =10 ; + s +=2 ; }else if (!*basep) {/* Only select octal if we don't have a base */ *basep =8 ;
test/str_ut.c +12 -0
@@ -111,6 +111,12 @@ static int str_simple_strtoul(struct unit_test_state *uts)/* Check endp being NULL */ ut_asserteq (1099 ,simple_strtoul (str2,NULL ,0 )); +/* check decimal */ +ut_assertok (run_strtoul (uts,"123fg" ,0 ,123 ,3 , false)); +ut_assertok (run_strtoul (uts,"123a" ,10 ,123 ,3 , false)); +ut_assertok (run_strtoul (uts,"0x123fg" ,0 ,0x123f ,6 , false)); +ut_assertok (run_strtoul (uts,"0n123a" ,16 ,123 ,5 , false)); +return 0 ; }STR_TEST (str_simple_strtoul,0 );
@@ -174,6 +180,12 @@ static int str_simple_strtoull(struct unit_test_state *uts)/* Check endp being NULL */ ut_asserteq (1099 ,simple_strtoull (str2,NULL ,0 )); +/* check decimal */ +ut_assertok (run_strtoull (uts,"123fg" ,0 ,123 ,3 , false)); +ut_assertok (run_strtoull (uts,"123a" ,10 ,123 ,3 , false)); +ut_assertok (run_strtoull (uts,"0x123fg" ,0 ,0x123f ,6 , false)); +ut_assertok (run_strtoull (uts,"0n123a" ,16 ,123 ,5 , false)); +return 0 ; }STR_TEST (str_simple_strtoull,0 );
Signature · 1 line
2.32.0.432.gabb21c7263-goog
PATCH v2 13/14 lib: Drop octal support
In reply to Simon GlassAt present if no expected base is provided, a 0 prefix indicates that the value is octal, so that 077 is interpreted as octal 77 (hex 3f).
If hex is expected, this is interpreted as hex 77 (hex 4d).
This is a little confusing. We could add a 0t or 0o prefix, but since octal is so rarely used, drop this feature altogether.
---
Changes in v2:
- Drop 0o feature and octal support
doc/usage/cmdline.rst | 9 --------- include/vsprintf.h | 25 +++++++++++++++++++------ lib/strto.c | 13 +++++-------- test/py/tests/test_hush_if_test.py | 11 ----------- test/str_ut.c | 10 ---------- 5 files changed, 24 insertions(+), 44 deletions(-)
doc/usage/cmdline.rst +0 -9
@@ -84,15 +84,6 @@ Some commands use decimal where it is more natural:: => i2c speed 100000 Setting bus speed to 100000 Hz -In some cases the default is decimal but it is possible to use octal if that is -useful:: - - pmic dev pmic@41 - dev: 1 @ pmic@41 - => pmic write 2 0177 - => pmic read 2 - 0x02: 0x00007f - It is possible to use a `0x` prefix to use a hex value if that is more convenient::
include/vsprintf.h +19 -6
@@ -26,9 +26,15 @@* If found, the base is set to hex (16). Similarly a decimal prefix (e.g. 0n12) * causes the base to be set to decimal (10). * -* If @base is 0: -* - an octal '0' prefix (e.g. 0777) sets the base to octal (8). -* - otherwise the base defaults to decimal (10). +* Note that the '0' prefix is not supported for octal. So when @base is 10, +* "0123" is interpreted as decimal 123, not octal. This is to avoid confusion +* with hex values which can start with 0. +* +* It would be possible to add a 0o prefix for octal, but this is not +* implemented since it is rarely used. See the 'setexpr' command for more +* options. +* +* If @base is 0 it defaults to decimal (10). */ ulong simple_strtoul (const char *cp,char **endp,unsigned int base);
@@ -80,9 +86,16 @@ unsigned long dectoul(const char *cp, char **endp);* If found, the base is set to hex (16). Similarly a decimal prefix (e.g. 0n12) * causes the base to be set to decimal (10). * -* If @base is 0: -* - an octal '0' prefix (e.g. 0777) sets the base to octal (8). -* - otherwise the base defaults to decimal (10). +* Note that the '0' prefix is not supported for octal. So when @base is 10, +* "0123" is interpreted as decimal 123, not octal. This is to avoid confusion +* with hex values which can start with 0. +* +* It would be possible to add a 0o prefix for octal, but this is not +* implemented since it is rarely used. See the 'setexpr' command for more +* options. +* +* +* If @base is 0 it defaults to decimal (10). * * Copied this function from Linux 2.6.38 commit ID: * 521cb40b0c44418a4fd36dc633f575813d59a43d
lib/strto.c +5 -8
@@ -20,16 +20,13 @@ static const char *_parse_integer_fixup_radix(const char *s, uint *basep)if (s[0 ] =='0' ) {int ch =tolower (s[1 ]); -if (ch =='x' ) { + s +=2 ; +if (ch =='x' ) *basep =16 ; - s +=2 ; - }else if (ch =='n' ) { +else if (ch =='n' ) *basep =10 ; - s +=2 ; - }else if (!*basep) { -/* Only select octal if we don't have a base */ - *basep =8 ; - } +else + s -=2 ;/* odd, nothing found */ }/* Use decimal by default */
test/py/tests/test_hush_if_test.py +0 -11
@@ -56,14 +56,6 @@ subtests = ( ('test 123 -ge 123', True), ('test 123 -ge 456', False), - # Octal tests - - ('test 010 -eq 010', True), - ('test 010 -eq 011', False), - - ('test 010 -ne 011', True), - ('test 010 -ne 010', False), - # Hexadecimal tests ('test 0x2000000 -gt 0x2000001', False),
@@ -72,10 +64,7 @@ subtests = ( # Mixed tests - ('test 010 -eq 10', False), - ('test 010 -ne 10', True), ('test 0xa -eq 10', True), - ('test 0xa -eq 012', True), ('test 2000000 -gt 0x1ffffff', False), ('test 0x2000000 -gt 1ffffff', True),
test/str_ut.c +0 -10
@@ -17,8 +17,6 @@ static const char str2[] = "1099abNo, don't bother apologising.";static const char str3[] ="0xbI'm sorry you're alive." ;static const char str4[] ="1234567890123 I lost closer friends" ;static const char str5[] ="0x9876543210the last time I was deloused" ; -static const char str6[] ="0778octal is seldom used" ; -static const char str7[] ="707it is a piece of computing history" ;/* Declare a new str test */ #define STR_TEST (_name, _flags) UNIT_TEST(_name, _flags, str_test)
@@ -91,10 +89,6 @@ static int str_simple_strtoul(struct unit_test_state *uts)ut_assertok (run_strtoul (uts, str3,16 ,0xb ,3 , upper));ut_assertok (run_strtoul (uts, str3,10 ,0xb ,3 , upper)); -/* Octal */ -ut_assertok (run_strtoul (uts, str6,0 ,63 ,3 , upper)); -ut_assertok (run_strtoul (uts, str7,8 ,0x1c7 ,3 , upper)); -/* Invalid string */ ut_assertok (run_strtoul (uts, str1,10 ,0 ,0 , upper));
@@ -152,10 +146,6 @@ static int str_simple_strtoull(struct unit_test_state *uts)ut_assertok (run_strtoull (uts, str3,16 ,0xb ,3 , upper));ut_assertok (run_strtoull (uts, str3,10 ,0xb ,3 , upper)); -/* Octal */ -ut_assertok (run_strtoull (uts, str6,0 ,63 ,3 , upper)); -ut_assertok (run_strtoull (uts, str7,8 ,0x1c7 ,3 , upper)); -/* Large values */ ut_assertok (run_strtoull (uts, str4,10 ,1234567890123 ,13 , upper));
Signature · 1 line
2.32.0.432.gabb21c7263-goog
PATCH v2 14/14 RFC: Change simple_strtoul() et al to default to hex
In reply to Simon GlassMost U-Boot commands use hex for numeric values. However there are quite a few places where a base of '0' is given, meaning to use the default.
At present the default input base is actually decimal, which seems confusing. Change this to hex.
NOTE: This is a breaking change, for discussion only. It needs more thought and careful checking of each use. Do not apply.
Also there is no documentation update here, since it is not yet clear what to say.
---
(no changes since v1)
include/vsprintf.h | 4 ++-- lib/strto.c | 4 ++-- test/str_ut.c | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-)
include/vsprintf.h +2 -2
@@ -34,7 +34,7 @@* implemented since it is rarely used. See the 'setexpr' command for more * options. * -* If @base is 0 it defaults to decimal (10). +* If @base is 0 it defaults to hex (16). */ ulong simple_strtoul (const char *cp,char **endp,unsigned int base);
@@ -95,7 +95,7 @@ unsigned long dectoul(const char *cp, char **endp);* options. * * -* If @base is 0 it defaults to decimal (10). +* If @base is 0 it defaults to hex (16). * * Copied this function from Linux 2.6.38 commit ID: * 521cb40b0c44418a4fd36dc633f575813d59a43d
lib/strto.c +2 -2
@@ -29,9 +29,9 @@ static const char *_parse_integer_fixup_radix(const char *s, uint *basep) s -=2 ;/* odd, nothing found */ } -/* Use decimal by default */ +/* Use hex by default */ if (!*basep) - *basep =10 ; + *basep =16 ;return s; }
test/str_ut.c +7 -6
@@ -94,19 +94,20 @@ static int str_simple_strtoul(struct unit_test_state *uts)/* Base 0 */ ut_assertok (run_strtoul (uts, str1,0 ,0 ,0 , upper)); -ut_assertok (run_strtoul (uts, str2,0 ,1099 ,4 , upper)); +ut_assertok (run_strtoul (uts, str2,0 ,0x1099ab ,6 , upper));ut_assertok (run_strtoul (uts, str3,0 ,0xb ,3 , upper));/* Base 2 */ ut_assertok (run_strtoul (uts, str1,2 ,0 ,0 , upper));ut_assertok (run_strtoul (uts, str2,2 ,2 ,2 , upper)); +ut_assertok (run_strtoul (uts, str3,2 ,0xb ,3 , upper)); }/* Check endp being NULL */ -ut_asserteq (1099 ,simple_strtoul (str2,NULL ,0 )); +ut_asserteq (0x1099ab ,simple_strtoul (str2,NULL ,0 ));/* check decimal */ -ut_assertok (run_strtoul (uts,"123fg" ,0 ,123 ,3 , false)); +ut_assertok (run_strtoul (uts,"123fg" ,0 ,0x123f ,4 , false));ut_assertok (run_strtoul (uts,"123a" ,10 ,123 ,3 , false));ut_assertok (run_strtoul (uts,"0x123fg" ,0 ,0x123f ,6 , false));ut_assertok (run_strtoul (uts,"0n123a" ,16 ,123 ,5 , false));
@@ -159,7 +160,7 @@ static int str_simple_strtoull(struct unit_test_state *uts)/* Base 0 */ ut_assertok (run_strtoull (uts, str1,0 ,0 ,0 , upper)); -ut_assertok (run_strtoull (uts, str2,0 ,1099 ,4 , upper)); +ut_assertok (run_strtoull (uts, str2,0 ,0x1099ab ,6 , upper));ut_assertok (run_strtoull (uts, str3,0 ,0xb ,3 , upper));/* Base 2 */
@@ -168,10 +169,10 @@ static int str_simple_strtoull(struct unit_test_state *uts) }/* Check endp being NULL */ -ut_asserteq (1099 ,simple_strtoull (str2,NULL ,0 )); +ut_asserteq (0x1099ab ,simple_strtoull (str2,NULL ,0 ));/* check decimal */ -ut_assertok (run_strtoull (uts,"123fg" ,0 ,123 ,3 , false)); +ut_assertok (run_strtoull (uts,"123fg" ,0 ,0x123f ,4 , false));ut_assertok (run_strtoull (uts,"123a" ,10 ,123 ,3 , false));ut_assertok (run_strtoull (uts,"0x123fg" ,0 ,0x123f ,6 , false));ut_assertok (run_strtoull (uts,"0n123a" ,16 ,123 ,5 , false));
Signature · 1 line
2.32.0.432.gabb21c7263-goog