]> git.dujemihanovic.xyz Git - u-boot.git/commit
treewide: convert (void *)devfdt_get_addr() to dev_read_addr_ptr()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 17 Jul 2020 05:36:46 +0000 (14:36 +0900)
committerSimon Glass <sjg@chromium.org>
Mon, 20 Jul 2020 17:37:47 +0000 (11:37 -0600)
commit3c12c62ba5fa12c988336a9de5784c6b5fbaac54
tree70381d65e1e42fe7aafb4dd525596ecd3c621179
parent6ec7545b99d62a5d931473e853aea30f8b9b2aa3
treewide: convert (void *)devfdt_get_addr() to dev_read_addr_ptr()

Use the _ptr suffixed variant instead of casting. Also, convert it to
dev_read_addr_ptr(), which is safe to CONFIG_OF_LIVE.

One curious part is an error check like follows in
drivers/watchdog/omap_wdt.c:

    priv->regs = (struct wd_timer *)devfdt_get_addr(dev);
    if (!priv->regs)
            return -EINVAL;

devfdt_get_addr() returns FDT_ADDR_T_NONE (i.e. -1) on error.
So, this code does not catch any error in DT parsing.

dev_read_addr_ptr() returns NULL on error, so this error check
will work.

I generated this commit by the following command:

 $ find . -name .git -prune -o -name '*.[ch]' -type f -print | \
   xargs sed -i -e 's/([^*)]*\*)devfdt_get_addr(/dev_read_addr_ptr(/'

I manually fixed drivers/usb/host/ehci-mx6.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
46 files changed:
drivers/adc/exynos-adc.c
drivers/clk/renesas/clk-rcar-gen2.c
drivers/clk/renesas/clk-rcar-gen3.c
drivers/gpio/gpio-rcar.c
drivers/gpio/mvebu_gpio.c
drivers/gpio/s5p_gpio.c
drivers/gpio/sunxi_gpio.c
drivers/i2c/at91_i2c.c
drivers/i2c/davinci_i2c.c
drivers/i2c/exynos_hs_i2c.c
drivers/i2c/s3c24x0_i2c.c
drivers/input/tegra-kbc.c
drivers/mmc/aspeed_sdhci.c
drivers/mmc/atmel_sdhci.c
drivers/mmc/ftsdc010_mci.c
drivers/mmc/hi6220_dw_mmc.c
drivers/mmc/iproc_sdhci.c
drivers/mmc/msm_sdhci.c
drivers/mmc/mv_sdhci.c
drivers/mmc/socfpga_dw_mmc.c
drivers/mmc/sti_sdhci.c
drivers/mmc/xenon_sdhci.c
drivers/pci_endpoint/pcie-cadence-ep.c
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
drivers/pwm/exynos_pwm.c
drivers/pwm/pwm-imx.c
drivers/pwm/pwm-mtk.c
drivers/pwm/sunxi_pwm.c
drivers/serial/serial_arc.c
drivers/serial/serial_xuartlite.c
drivers/spi/atmel_spi.c
drivers/spi/designware_spi.c
drivers/spi/exynos_spi.c
drivers/spi/kirkwood_spi.c
drivers/spi/mtk_snfi_spi.c
drivers/spi/mvebu_a3700_spi.c
drivers/spi/zynq_spi.c
drivers/usb/host/ehci-mx5.c
drivers/usb/host/ehci-mx6.c
drivers/usb/host/ehci-omap.c
drivers/usb/host/ehci-vf.c
drivers/usb/host/ohci-da8xx.c
drivers/usb/host/ohci-generic.c
drivers/video/atmel_hlcdfb.c
drivers/video/tegra.c
drivers/watchdog/omap_wdt.c