]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
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)
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

index 12c49fc8cefbaa3f5e5bdf236e69ec220a3dd3cb..b459b5705076a7b5a702cf0d113d24f12b88824e 100644 (file)
@@ -106,7 +106,7 @@ int exynos_adc_ofdata_to_platdata(struct udevice *dev)
        struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
        struct exynos_adc_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct exynos_adc_v2 *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        if (priv->regs == (struct exynos_adc_v2 *)FDT_ADDR_T_NONE) {
                pr_err("Dev: %s - can't get address!", dev->name);
                return -ENODATA;
index 3ed0aa92cb82281197842323c44a968631740613..16da10c8dd88047f31de630bbd9311da7148bc85 100644 (file)
@@ -283,7 +283,7 @@ int gen2_clk_probe(struct udevice *dev)
        u32 cpg_mode;
        int ret;
 
-       priv->base = (struct gen2_base *)devfdt_get_addr(dev);
+       priv->base = dev_read_addr_ptr(dev);
        if (!priv->base)
                return -EINVAL;
 
index 15e38337567370cc72fb43a179e5decedf13770a..30a101fe8621997713d86f504493117fdfe56a47 100644 (file)
@@ -359,7 +359,7 @@ int gen3_clk_probe(struct udevice *dev)
        u32 cpg_mode;
        int ret;
 
-       priv->base = (struct gen3_base *)devfdt_get_addr(dev);
+       priv->base = dev_read_addr_ptr(dev);
        if (!priv->base)
                return -EINVAL;
 
index c49a041059d24f18ba7cc465c896ecb3a70b8896..a993fd4d7003c41ffa141c69384a8fb233cb9a81 100644 (file)
@@ -148,7 +148,7 @@ static int rcar_gpio_probe(struct udevice *dev)
        int node = dev_of_offset(dev);
        int ret;
 
-       priv->regs = (void __iomem *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        uc_priv->bank_name = dev->name;
 
        ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, node, "gpio-ranges",
index 770cbf6b607245cb3ab31b8d476a4d92a89ec97b..65eaa71c201c116449a3ff85fc33c9af22157d97 100644 (file)
@@ -90,7 +90,7 @@ static int mvebu_gpio_probe(struct udevice *dev)
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
        struct mvebu_gpio_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct mvebu_gpio_regs *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        uc_priv->gpio_count = MVEBU_GPIOS_PER_BANK;
        priv->name[0] = 'A' + dev->req_seq;
        uc_priv->bank_name = priv->name;
index 258f13395dde4f24ce29ce2dd03b386aedf47075..4a68f44704ba420867c3149444fb8aebf9ae84cf 100644 (file)
@@ -316,7 +316,7 @@ static int gpio_exynos_bind(struct udevice *parent)
        if (plat)
                return 0;
 
-       base = (struct s5p_gpio_bank *)devfdt_get_addr(parent);
+       base = dev_read_addr_ptr(parent);
        for (node = fdt_first_subnode(blob, dev_of_offset(parent)), bank = base;
             node > 0;
             node = fdt_next_subnode(blob, node), bank++) {
index 9c3a4428e11fb68c6a9520eb8ded5d8dea4a81f3..3efccf496fc3af53e52845e128b4459f085fb95f 100644 (file)
@@ -293,7 +293,7 @@ static int gpio_sunxi_bind(struct udevice *parent)
        if (plat)
                return 0;
 
-       ctlr = (struct sunxi_gpio_reg *)devfdt_get_addr(parent);
+       ctlr = dev_read_addr_ptr(parent);
        for (bank = 0; bank < soc_data->no_banks; bank++) {
                struct sunxi_gpio_platdata *plat;
                struct udevice *dev;
index c817ed6bf9597e343d4c2b308d7f375240241941..9d6c6d80e2a6047c573d96d1fa28c06419b92998 100644 (file)
@@ -225,7 +225,7 @@ static int at91_i2c_ofdata_to_platdata(struct udevice *dev)
        struct at91_i2c_bus *bus = dev_get_priv(dev);
        int node = dev_of_offset(dev);
 
-       bus->regs = (struct at91_i2c_regs *)devfdt_get_addr(dev);
+       bus->regs = dev_read_addr_ptr(dev);
        bus->pdata = (struct at91_i2c_pdata *)dev_get_driver_data(dev);
        bus->clock_frequency = fdtdec_get_int(blob, node,
                                              "clock-frequency", 100000);
index f8e9d003e61c9674bd8646fa5fbe72dcc1c48a34..a54f2151fd3ae88d855b23e8a85a24d9a2d4b51f 100644 (file)
@@ -471,7 +471,7 @@ static int davinci_i2c_probe(struct udevice *dev)
        struct i2c_bus *i2c_bus = dev_get_priv(dev);
 
        i2c_bus->id = dev->seq;
-       i2c_bus->regs = (struct i2c_regs *)devfdt_get_addr(dev);
+       i2c_bus->regs = dev_read_addr_ptr(dev);
 
        i2c_bus->speed = 100000;
         _davinci_i2c_init(i2c_bus->regs, i2c_bus->speed, 0);
index 4fc9d90580c5256c17878dd1043d572de87caf87..5785adedb6d06a21df7ec57353ea9c911a1ff531 100644 (file)
@@ -525,7 +525,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
 
        node = dev_of_offset(dev);
 
-       i2c_bus->hsregs = (struct exynos5_hsi2c *)devfdt_get_addr(dev);
+       i2c_bus->hsregs = dev_read_addr_ptr(dev);
 
        i2c_bus->id = pinmux_decode_periph_id(blob, node);
 
index 5907217981dc3b68ca91ea0228dbb2e378541a81..cb45d3c100fedb3105a91cd94dedac4bab08d5da 100644 (file)
@@ -310,7 +310,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
 
        node = dev_of_offset(dev);
 
-       i2c_bus->regs = (struct s3c24x0_i2c *)devfdt_get_addr(dev);
+       i2c_bus->regs = dev_read_addr_ptr(dev);
 
        i2c_bus->id = pinmux_decode_periph_id(blob, node);
 
index 3409bb61d54c6e870da7e194985bda4198824c83..f07a51dc30768c15bd38076f63ca1c038f8d090d 100644 (file)
@@ -291,7 +291,7 @@ static int tegra_kbd_probe(struct udevice *dev)
        struct input_config *input = &uc_priv->input;
        int ret;
 
-       priv->kbc = (struct kbc_tegra *)devfdt_get_addr(dev);
+       priv->kbc = dev_read_addr_ptr(dev);
        if ((fdt_addr_t)priv->kbc == FDT_ADDR_T_NONE) {
                debug("%s: No keyboard register found\n", __func__);
                return -EINVAL;
index 8929e603f3384099ca1de53d7ae8ec061c03489f..543c65a8e359af22cfcdb6629eaecb4f7faf753a 100644 (file)
@@ -34,7 +34,7 @@ static int aspeed_sdhci_probe(struct udevice *dev)
                goto free;
 
        host->name = dev->name;
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
 
        max_clk = clk_get_rate(&clk);
        if (IS_ERR_VALUE(max_clk)) {
index 2b797c9bd4005485a5fac7210cfa753e1c0f73b1..0c53caf448c67382cacddd1b1e9d3144e19e7aa1 100644 (file)
@@ -69,7 +69,7 @@ static int atmel_sdhci_probe(struct udevice *dev)
                return ret;
 
        host->name = dev->name;
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
 
        host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD;
        host->bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
index fb28f0166f03357fc66db5e2ac2dd08bc18f6cd9..bc0d5ffed5153a10ac85a387b995023c4002b7a6 100644 (file)
@@ -395,7 +395,7 @@ static int ftsdc010_mmc_ofdata_to_platdata(struct udevice *dev)
        struct ftsdc_priv *priv = dev_get_priv(dev);
        struct ftsdc010_chip *chip = &priv->chip;
        chip->name = dev->name;
-       chip->ioaddr = (void *)devfdt_get_addr(dev);
+       chip->ioaddr = dev_read_addr_ptr(dev);
        chip->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        chip->priv = dev;
index 6de7924383594f72679c9b16c85eaf78c88e21b7..67d6a05b3b5b2ad9c31b2c8c29aac24d8c9f227d 100644 (file)
@@ -33,7 +33,7 @@ static int hi6220_dwmmc_ofdata_to_platdata(struct udevice *dev)
        struct dwmci_host *host = &priv->host;
 
        host->name = dev->name;
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
        host->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
 
index 91e2e3f0b87200461ebade9e04059485b25b8203..9f530638e31308c6745fc62966bcdd4cf72448fa 100644 (file)
@@ -188,7 +188,7 @@ static int iproc_sdhci_probe(struct udevice *dev)
        iproc_host->shadow_blk = 0;
 
        host->name = dev->name;
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
        host->voltages = MMC_VDD_165_195 |
                         MMC_VDD_32_33 | MMC_VDD_33_34;
        host->quirks = SDHCI_QUIRK_BROKEN_VOLTAGE | SDHCI_QUIRK_BROKEN_R1B;
index da3ae2ec3585e5ba214ca29d0773114517f4128f..56c3e35c9e9857aab40f3973d9a7b11126a387c8 100644 (file)
@@ -171,7 +171,7 @@ static int msm_ofdata_to_platdata(struct udevice *dev)
        int node = dev_of_offset(dev);
 
        host->name = strdup(dev->name);
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
        host->bus_width = fdtdec_get_int(gd->fdt_blob, node, "bus-width", 4);
        host->index = fdtdec_get_uint(gd->fdt_blob, node, "index", 0);
        priv->base = (void *)fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
index f5f3e43247196eac38e5eaf473e98d33f801311a..9b3dfa13e619fb33c7b3d84d14f86ddbed07b2d7 100644 (file)
@@ -112,7 +112,7 @@ static int mv_sdhci_probe(struct udevice *dev)
        int ret;
 
        host->name = MVSDH_NAME;
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
        host->quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_WAIT_SEND_CMD;
        host->mmc = &plat->mmc;
        host->mmc->dev = dev;
index 892222d27da9ec913b7cc5a4abab6fbad1e114a2..0022f943bd733af1c8f27f5dd49315bbeea2c829 100644 (file)
@@ -109,7 +109,7 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
        }
 
        host->name = dev->name;
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
        host->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        host->clksel = socfpga_dwmci_clksel;
index 9bcd8ce5f6c15b28287f4ee4863e2d9d6a0ab5d7..5578feebef7265c0fd7caa9e9f06f4f49118764b 100644 (file)
@@ -116,7 +116,7 @@ static int sti_sdhci_ofdata_to_platdata(struct udevice *dev)
        struct sdhci_host *host = dev_get_priv(dev);
 
        host->name = strdup(dev->name);
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
 
        host->bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "bus-width", 4);
index e765dd384acb33df92868ff134b7b08c9818495f..356dd9846d6f69376c42b4b4aa5c07ba85741009 100644 (file)
@@ -455,7 +455,7 @@ static int xenon_sdhci_ofdata_to_platdata(struct udevice *dev)
        const char *name;
 
        host->name = dev->name;
-       host->ioaddr = (void *)devfdt_get_addr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
 
        if (device_is_compatible(dev, "marvell,armada-3700-sdhci"))
                priv->pad_ctrl_reg = (void *)devfdt_get_addr_index(dev, 1);
index 59231d340a54d279526981dce7af6d2879d277b8..74dfdde154ee8eb8135b2e656d60364c90b3f63f 100644 (file)
@@ -144,7 +144,7 @@ static int cdns_pci_ep_probe(struct udevice *dev)
 {
        struct cdns_pcie *pdata = dev_get_priv(dev);
 
-       pdata->reg_base = (void __iomem *)devfdt_get_addr(dev);
+       pdata->reg_base = dev_read_addr_ptr(dev);
        if (!pdata->reg_base)
                return -ENOMEM;
 
index 2dee79af17ebaf1cae4424b34ffd381ecf68093a..fb497803b9391fc36d7a858952799e366d7b935b 100644 (file)
@@ -592,7 +592,7 @@ int armada_37xx_pinctrl_probe(struct udevice *dev)
        info->data = (struct armada_37xx_pin_data *)dev_get_driver_data(dev);
        pin_data = info->data;
 
-       info->base = (void __iomem *)devfdt_get_addr(dev);
+       info->base = dev_read_addr_ptr(dev);
        if (!info->base) {
                pr_err("unable to find regmap\n");
                return -ENODEV;
index fed1583796af59fde7a07c4d24a3c17f15aba2f1..e55fcceafd711fd1f5b6b544166a51a0509cb799 100644 (file)
@@ -92,7 +92,7 @@ static int exynos_pwm_ofdata_to_platdata(struct udevice *dev)
 {
        struct exynos_pwm_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct s5p_timer *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
 
        return 0;
 }
index f5b9544cb8ddbe102928e45533bac41d32de0733..77a1907fd3ba7a0a0de69ea8d9dce75989b8fe9b 100644 (file)
@@ -130,7 +130,7 @@ static int imx_pwm_ofdata_to_platdata(struct udevice *dev)
 {
        struct imx_pwm_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct pwm_regs *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
 
        return 0;
 }
index 97ed477025f4e84a29b3b91826b75791c8fec6d7..7bd82518d67ba109bf748dd430617809f132ec74 100644 (file)
@@ -130,7 +130,7 @@ static int mtk_pwm_probe(struct udevice *dev)
        int i;
 
        priv->soc = (struct mtk_pwm_soc *)dev_get_driver_data(dev);
-       priv->base = (void __iomem *)devfdt_get_addr(dev);
+       priv->base = dev_read_addr_ptr(dev);
        if (!priv->base)
                return -EINVAL;
        ret = clk_get_by_name(dev, "top", &priv->top_clk);
index 56215dbf6c22304fdf07b2d7416d5013a1be6ee0..e2ae1a8009193e8e82da753aa13f3e5882c98d0c 100644 (file)
@@ -152,7 +152,7 @@ static int sunxi_pwm_ofdata_to_platdata(struct udevice *dev)
 {
        struct sunxi_pwm_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct sunxi_pwm *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
 
        return 0;
 }
index 70dbc6d6b53f50eaaceba28d47e528fa95363fac..04063fbe39976001ff02edd134bea74a779bb989 100644 (file)
@@ -114,7 +114,7 @@ static int arc_serial_ofdata_to_platdata(struct udevice *dev)
        struct arc_serial_platdata *plat = dev_get_platdata(dev);
        DECLARE_GLOBAL_DATA_PTR;
 
-       plat->reg = (struct arc_serial_regs *)devfdt_get_addr(dev);
+       plat->reg = dev_read_addr_ptr(dev);
        plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                       "clock-frequency", 0);
 
index f29a9a0b569c549732b3fb7ece637b65f5e92c49..5116d13751ded062ff4addb62d4fb065445d6536 100644 (file)
@@ -85,7 +85,7 @@ static int uartlite_serial_ofdata_to_platdata(struct udevice *dev)
 {
        struct uartlite_platdata *plat = dev_get_platdata(dev);
 
-       plat->regs = (struct uartlite *)devfdt_get_addr(dev);
+       plat->regs = dev_read_addr_ptr(dev);
 
        return 0;
 }
index b120664661ec16fbca67eeadd158f2e54eaee564..c65733c87ac67ac0bcefa2732406c6667c497f51 100644 (file)
@@ -351,7 +351,7 @@ static int atmel_spi_probe(struct udevice *bus)
        if (ret)
                return ret;
 
-       bus_plat->regs = (struct at91_spi *)devfdt_get_addr(bus);
+       bus_plat->regs = dev_read_addr_ptr(bus);
 
 #if CONFIG_IS_ENABLED(DM_GPIO)
        struct atmel_spi_priv *priv = dev_get_priv(bus);
index c9b14f90292ec2898dce6471385d6ac390b7138a..2559aac2e942be0a1188d34b069742f7b1d3b9f1 100644 (file)
@@ -157,7 +157,7 @@ static int dw_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct dw_spi_platdata *plat = bus->platdata;
 
-       plat->regs = (struct dw_spi *)devfdt_get_addr(bus);
+       plat->regs = dev_read_addr_ptr(bus);
 
        /* Use 500KHz as a suitable default */
        plat->frequency = dev_read_u32_default(bus, "spi-max-frequency",
index 746686a18afa783b595daf9ca54a5e48e4005646..d338ff5a0bd149089620cea7c8de854d89019153 100644 (file)
@@ -257,7 +257,7 @@ static int exynos_spi_ofdata_to_platdata(struct udevice *bus)
        const void *blob = gd->fdt_blob;
        int node = dev_of_offset(bus);
 
-       plat->regs = (struct exynos_spi *)devfdt_get_addr(bus);
+       plat->regs = dev_read_addr_ptr(bus);
        plat->periph_id = pinmux_decode_periph_id(blob, node);
 
        if (plat->periph_id == PERIPH_ID_NONE) {
index 92dc2e13c55cae46515f8354ab6bf26e11cf613d..dc7d2bc1f01cfad0bdcfb57ada32ce514ba61e35 100644 (file)
@@ -236,7 +236,7 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
        const struct mvebu_spi_dev *drvdata =
                (struct mvebu_spi_dev *)dev_get_driver_data(bus);
 
-       plat->spireg = (struct kwspi_registers *)devfdt_get_addr(bus);
+       plat->spireg = dev_read_addr_ptr(bus);
        plat->is_errata_50mhz_ac = drvdata->is_errata_50mhz_ac;
 
        return 0;
index 2a8947651597c0da8a7150a6d70a3d608fc0d8c2..c30c8f4ff6d3d4aa93a87e04be5ad4937eab9e9d 100644 (file)
@@ -253,7 +253,7 @@ static int mtk_snfi_spi_probe(struct udevice *bus)
        struct mtk_snfi_priv *priv = dev_get_priv(bus);
        int ret;
 
-       priv->base = (void __iomem *)devfdt_get_addr(bus);
+       priv->base = dev_read_addr_ptr(bus);
        if (!priv->base)
                return -EINVAL;
 
index 2302e62be4f246474df050a7a6edf256ca28b383..e860b9ec64becf12fed7070b81bf1e0a30f7b320 100644 (file)
@@ -255,7 +255,7 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
        struct mvebu_spi_platdata *plat = dev_get_platdata(bus);
        int ret;
 
-       plat->spireg = (struct spi_reg *)devfdt_get_addr(bus);
+       plat->spireg = dev_read_addr_ptr(bus);
 
        ret = clk_get_by_index(bus, 0, &plat->clk);
        if (ret) {
index 78ffd3e2fe05d3c1d726e96ee738328405bf0253..9923931e36ec95cad7049627c24e1d16325d838f 100644 (file)
@@ -77,7 +77,7 @@ static int zynq_spi_ofdata_to_platdata(struct udevice *bus)
        const void *blob = gd->fdt_blob;
        int node = dev_of_offset(bus);
 
-       plat->regs = (struct zynq_spi_regs *)devfdt_get_addr(bus);
+       plat->regs = dev_read_addr_ptr(bus);
 
        /* FIXME: Use 250MHz as a suitable default */
        plat->frequency = fdtdec_get_int(blob, node, "spi-max-frequency",
index 212b3623325d4ebda9aa797457de6547e031e601..caafa688993f1c04f500c50c4eb32e116faff612 100644 (file)
@@ -306,7 +306,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
 static int ehci_usb_probe(struct udevice *dev)
 {
        struct usb_platdata *plat = dev_get_platdata(dev);
-       struct usb_ehci *ehci = (struct usb_ehci *)devfdt_get_addr(dev);
+       struct usb_ehci *ehci = dev_read_addr_ptr(dev);
        struct ehci_mx5_priv_data *priv = dev_get_priv(dev);
        enum usb_init_type type = plat->init_type;
        struct ehci_hccr *hccr;
index 5f84c7b91d8a91e5b67c2628809d6d286db3d8bb..37b59758bb38c8901d104cdacaf7ecb2be44507a 100644 (file)
@@ -473,7 +473,7 @@ static const struct ehci_ops mx6_ehci_ops = {
 static int ehci_usb_phy_mode(struct udevice *dev)
 {
        struct usb_platdata *plat = dev_get_platdata(dev);
-       void *__iomem addr = (void *__iomem)devfdt_get_addr(dev);
+       void *__iomem addr = dev_read_addr_ptr(dev);
        void *__iomem phy_ctrl, *__iomem phy_status;
        const void *blob = gd->fdt_blob;
        int offset = dev_of_offset(dev), phy_off;
@@ -580,7 +580,7 @@ static int ehci_usb_bind(struct udevice *dev)
 static int ehci_usb_probe(struct udevice *dev)
 {
        struct usb_platdata *plat = dev_get_platdata(dev);
-       struct usb_ehci *ehci = (struct usb_ehci *)devfdt_get_addr(dev);
+       struct usb_ehci *ehci = dev_read_addr_ptr(dev);
        struct ehci_mx6_priv_data *priv = dev_get_priv(dev);
        enum usb_init_type type = plat->init_type;
        struct ehci_hccr *hccr;
index 93ab83941de23f58b4e3149dcc1ccd41a7634688..82b99eeef1e9d3d2dcf25d10b5af767cd87aa04a 100644 (file)
@@ -382,7 +382,7 @@ static int omap_ehci_probe(struct udevice *dev)
        struct ehci_hccr *hccr;
        struct ehci_hcor *hcor;
 
-       priv->ehci = (struct omap_ehci *)devfdt_get_addr(dev);
+       priv->ehci = dev_read_addr_ptr(dev);
        priv->portnr = dev->seq;
        priv->init_type = plat->init_type;
 
index 562207d3d26c2c9ab0242d50b12a52db6ed45569..2768d409749979783d031eeaa88998c34af3919a 100644 (file)
@@ -224,7 +224,7 @@ static int vf_usb_ofdata_to_platdata(struct udevice *dev)
 
        priv->portnr = dev->seq;
 
-       priv->ehci = (struct usb_ehci *)devfdt_get_addr(dev);
+       priv->ehci = dev_read_addr_ptr(dev);
        mode = fdt_getprop(dt_blob, node, "dr_mode", NULL);
        if (mode) {
                if (0 == strcmp(mode, "host")) {
index 692018243c8e8bfa1dcf0079a57c09b17d91f4fe..22e7b565b5bf3552c8254892bed57be0a5153602 100644 (file)
@@ -89,7 +89,7 @@ int usb_cpu_init_fail(void)
 #if CONFIG_IS_ENABLED(DM_USB)
 static int ohci_da8xx_probe(struct udevice *dev)
 {
-       struct ohci_regs *regs = (struct ohci_regs *)devfdt_get_addr(dev);
+       struct ohci_regs *regs = dev_read_addr_ptr(dev);
        struct da8xx_ohci *priv = dev_get_priv(dev);
        int i, err, ret, clock_nb;
 
index 631711a9e8fa617cbe37b42953fe46cc96f7ab67..b84bf8ac0f7c22cc6c9f10dac9228461dd276eb2 100644 (file)
@@ -79,7 +79,7 @@ static int ohci_shutdown_phy(struct udevice *dev)
 
 static int ohci_usb_probe(struct udevice *dev)
 {
-       struct ohci_regs *regs = (struct ohci_regs *)devfdt_get_addr(dev);
+       struct ohci_regs *regs = dev_read_addr_ptr(dev);
        struct generic_ohci *priv = dev_get_priv(dev);
        int i, err, ret, clock_nb, reset_nb;
 
index 35a56a8eab2ec1438603eb966ac7f6c1a2848476..38def2816b2a48679629a22954e19ab9c782f82e 100644 (file)
@@ -507,7 +507,7 @@ static int atmel_hlcdc_ofdata_to_platdata(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int node = dev_of_offset(dev);
 
-       priv->regs = (struct atmel_hlcd_regs *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        if (!priv->regs) {
                debug("%s: No display controller address\n", __func__);
                return -EINVAL;
index 1208d9128682e083452da34a3ff0d4b8c8e02429..827ea13d13a576c6471b163b9890cba6ec295b81 100644 (file)
@@ -346,7 +346,7 @@ static int tegra_lcd_ofdata_to_platdata(struct udevice *dev)
        int rgb;
        int ret;
 
-       priv->disp = (struct disp_ctlr *)devfdt_get_addr(dev);
+       priv->disp = dev_read_addr_ptr(dev);
        if (!priv->disp) {
                debug("%s: No display controller address\n", __func__);
                return -EINVAL;
index ed8b2199c292ae3ac59365e1d556acc0050bdca8..9059a4c6105b1d73c2af08a5419eafbdb71c9daa 100644 (file)
@@ -237,7 +237,7 @@ static int omap3_wdt_probe(struct udevice *dev)
 {
        struct omap3_wdt_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct wd_timer *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        if (!priv->regs)
                return -EINVAL;