]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
treewide: convert devfdt_get_addr_ptr() to dev_read_addr_ptr()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 4 Aug 2020 05:14:43 +0000 (14:14 +0900)
committerSimon Glass <sjg@chromium.org>
Sat, 22 Aug 2020 14:53:37 +0000 (08:53 -0600)
When you enable CONFIG_OF_LIVE, you will end up with a lot of
conversions.

To help this tedious work, this commit converts devfdt_get_addr_ptr()
to dev_read_addr_ptr() by coccinelle. I also removed redundant casts
because dev_read_addr_ptr() returns an opaque pointer.

To generate this commit, I ran the following semantic patch
excluding include/dm/.

  <smpl>
  @@
  type T;
  expression dev;
  @@
  -(T *)devfdt_get_addr_ptr(dev)
  +dev_read_addr_ptr(dev)
  @@
  expression dev;
  @@
  -devfdt_get_addr_ptr(dev)
  +dev_read_addr_ptr(dev)
  </smpl>

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 files changed:
drivers/clk/aspeed/clk_ast2500.c
drivers/clk/at91/pmc.c
drivers/gpio/hsdk-creg-gpio.c
drivers/i2c/ast_i2c.c
drivers/i2c/designware_i2c.c
drivers/i2c/mv_i2c.c
drivers/i2c/mvtwsi.c
drivers/mmc/gen_atmel_mci.c
drivers/mmc/snps_dw_mmc.c
drivers/pinctrl/mvebu/pinctrl-mvebu.c
drivers/reset/reset-socfpga.c
drivers/serial/serial_mvebu_a3700.c
drivers/spi/uniphier_spi.c
drivers/sysreset/sysreset_socfpga.c
drivers/timer/ast_timer.c
drivers/timer/atmel_pit_timer.c
drivers/usb/host/ehci-zynq.c
drivers/watchdog/ast_wdt.c

index 284f5f58d6e2d35a43faf940f1e0e81254da1045..d1940f188495f9493d5467f524a1e4700553d63b 100644 (file)
@@ -497,7 +497,7 @@ static int ast2500_clk_ofdata_to_platdata(struct udevice *dev)
 {
        struct ast2500_clk_priv *priv = dev_get_priv(dev);
 
-       priv->scu = devfdt_get_addr_ptr(dev);
+       priv->scu = dev_read_addr_ptr(dev);
        if (!priv->scu)
                return -EINVAL;
 
index 54ae0d281d0a4a1ab84b74724b2a618ac26c0e09..ca90abef2d53038b5bb9bea80f6ee667bbfbc842 100644 (file)
@@ -41,7 +41,7 @@ int at91_pmc_core_probe(struct udevice *dev)
 
        dev = dev_get_parent(dev);
 
-       plat->reg_base = (struct at91_pmc *)devfdt_get_addr_ptr(dev);
+       plat->reg_base = dev_read_addr_ptr(dev);
 
        return 0;
 }
@@ -116,7 +116,7 @@ int at91_clk_probe(struct udevice *dev)
        dev_periph_container = dev_get_parent(dev);
        dev_pmc = dev_get_parent(dev_periph_container);
 
-       plat->reg_base = (struct at91_pmc *)devfdt_get_addr_ptr(dev_pmc);
+       plat->reg_base = dev_read_addr_ptr(dev_pmc);
 
        return 0;
 }
index d9df804f6390dfaa6af964a59d62c92273528a66..35b114904d527ee2d6413bffb47a0836d2579c20 100644 (file)
@@ -83,7 +83,7 @@ static int hsdk_creg_gpio_probe(struct udevice *dev)
        u32 shift, bit_per_gpio, activate, deactivate, gpio_count;
        const u8 *defaults;
 
-       hcg->regs = (u32 *)devfdt_get_addr_ptr(dev);
+       hcg->regs = dev_read_addr_ptr(dev);
        gpio_count = dev_read_u32_default(dev, "gpio-count", 1);
        shift = dev_read_u32_default(dev, "gpio-first-shift", 0);
        bit_per_gpio = dev_read_u32_default(dev, "gpio-bit-per-line", 1);
index 253e653666ae29d364bb6abc1e1b09ed7c0b713c..2cdfb5561b7dff8866daf0c317405c6a058738d9 100644 (file)
@@ -92,7 +92,7 @@ static int ast_i2c_ofdata_to_platdata(struct udevice *dev)
        struct ast_i2c_priv *priv = dev_get_priv(dev);
        int ret;
 
-       priv->regs = devfdt_get_addr_ptr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        if (!priv->regs)
                return -EINVAL;
 
index cf892c69d9f3a7e91833f43acc34a5985092779d..569a5d39b49eac2725479f36a799cb7c035acb0a 100644 (file)
@@ -768,7 +768,7 @@ int designware_i2c_ofdata_to_platdata(struct udevice *bus)
        int ret;
 
        if (!priv->regs)
-               priv->regs = (struct i2c_regs *)devfdt_get_addr_ptr(bus);
+               priv->regs = dev_read_addr_ptr(bus);
        dev_read_u32(bus, "i2c-scl-rising-time-ns", &priv->scl_rise_time_ns);
        dev_read_u32(bus, "i2c-scl-falling-time-ns", &priv->scl_fall_time_ns);
        dev_read_u32(bus, "i2c-sda-hold-time-ns", &priv->sda_hold_time_ns);
index 59675d8d57425a6a11014b1bf0f2068720463657..82e8fdac4137336c1738cf70af1ffd8b1480dc27 100644 (file)
@@ -580,7 +580,7 @@ static int mv_i2c_probe(struct udevice *bus)
 {
        struct mv_i2c_priv *priv = dev_get_priv(bus);
 
-       priv->base = (void *)devfdt_get_addr_ptr(bus);
+       priv->base = dev_read_addr_ptr(bus);
 
        return 0;
 }
index d3cc9b9d83845138900ba593a31c437909ffdaa6..fdb8fd42e5c0d395cafccc1cc295a6aac8be02ac 100644 (file)
@@ -798,7 +798,7 @@ static int mvtwsi_i2c_ofdata_to_platdata(struct udevice *bus)
 {
        struct mvtwsi_i2c_dev *dev = dev_get_priv(bus);
 
-       dev->base = devfdt_get_addr_ptr(bus);
+       dev->base = dev_read_addr_ptr(bus);
 
        if (!dev->base)
                return -ENOMEM;
@@ -820,7 +820,7 @@ static void twsi_disable_i2c_slave(struct mvtwsi_registers *twsi)
 
 static int mvtwsi_i2c_bind(struct udevice *bus)
 {
-       struct mvtwsi_registers *twsi = devfdt_get_addr_ptr(bus);
+       struct mvtwsi_registers *twsi = dev_read_addr_ptr(bus);
 
        /* Disable the hidden slave in i2c0 of these platforms */
        if ((IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_ARCH_KIRKWOOD))
index 9d20e283839c80d0f5d912ea16d88b0bea892d66..0a347b2fb202bcd9930962f28ab92193f6615715 100644 (file)
@@ -592,7 +592,7 @@ static int atmel_mci_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       plat->mci = (struct atmel_mci *)devfdt_get_addr_ptr(dev);
+       plat->mci = dev_read_addr_ptr(dev);
 
        atmel_mci_setup_cfg(dev);
 
index c606ef011bff614d9e99350efc8d50d48aa9a84a..4b468a1f3db74ffdc15eabdc1e2d22a14083e084 100644 (file)
@@ -83,7 +83,7 @@ static int snps_dwmmc_ofdata_to_platdata(struct udevice *dev)
        u32 fifo_depth;
        int ret;
 
-       host->ioaddr = devfdt_get_addr_ptr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
 
        /*
         * If fifo-depth is unset don't set fifoth_val - we will try to
index ac0377e7968cfc7f9b41b888d49f9e7bec2c77ea..146f5c6e426c17de2b149b0cce13b7bb9ccce120 100644 (file)
@@ -193,7 +193,7 @@ int mvebu_pinctl_probe(struct udevice *dev)
                return -EINVAL;
        }
 
-       priv->base_reg = devfdt_get_addr_ptr(dev);
+       priv->base_reg = dev_read_addr_ptr(dev);
        if (!priv->base_reg) {
                debug("%s: Failed to get base address\n", __func__);
                return -EINVAL;
index 830eda9430ecf8718c1cfee768e44a8f32638a24..1849db4da9b076bf839e8a46dee8d4315def7cf8 100644 (file)
@@ -118,7 +118,7 @@ static int socfpga_reset_probe(struct udevice *dev)
        u32 modrst_offset;
        void __iomem *membase;
 
-       membase = devfdt_get_addr_ptr(dev);
+       membase = dev_read_addr_ptr(dev);
 
        modrst_offset = dev_read_u32_default(dev, "altr,modrst-offset", 0x10);
        data->modrst_base = membase + modrst_offset;
index 7e4cd6c4b49b4d9dbe59b2096a337bd356f6b488..fb43f88eaf6e49c64082f689c715a08ef1f4398a 100644 (file)
@@ -104,7 +104,7 @@ static int mvebu_serial_ofdata_to_platdata(struct udevice *dev)
 {
        struct mvebu_platdata *plat = dev_get_platdata(dev);
 
-       plat->base = devfdt_get_addr_ptr(dev);
+       plat->base = dev_read_addr_ptr(dev);
 
        return 0;
 }
index 114bd8abd7a63cd4353b2fde3e9f739b12b84e6c..b6456685f8d45e0ed0b83c38039e26ed175d2778 100644 (file)
@@ -368,7 +368,7 @@ static int uniphier_spi_ofdata_to_platdata(struct udevice *bus)
        const void *blob = gd->fdt_blob;
        int node = dev_of_offset(bus);
 
-       plat->base = devfdt_get_addr_ptr(bus);
+       plat->base = dev_read_addr_ptr(bus);
 
        plat->frequency =
                fdtdec_get_int(blob, node, "spi-max-frequency", 12500000);
index 178bcb227ff878862c1f8abe8c1e0b0b94a2d56a..67cec6563a2c0c927bac228dec82aa50cad8cf81 100644 (file)
@@ -40,7 +40,7 @@ static int socfpga_sysreset_probe(struct udevice *dev)
 {
        struct socfpga_sysreset_data *data = dev_get_priv(dev);
 
-       data->rstmgr_base = devfdt_get_addr_ptr(dev);
+       data->rstmgr_base = dev_read_addr_ptr(dev);
        return 0;
 }
 
index 9f28cbfcf9aaff39bf1bf921de27d59e1e73ee50..e3132497404de40e5517920490d19e420e7624ea 100644 (file)
@@ -64,7 +64,7 @@ static int ast_timer_ofdata_to_platdata(struct udevice *dev)
 {
        struct ast_timer_priv *priv = dev_get_priv(dev);
 
-       priv->regs = devfdt_get_addr_ptr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        if (!priv->regs)
                return -EINVAL;
 
index 70511697fef74345b3b64f571a0063c9acaba6ea..843d670b5e22921c86e30795f0c6f194c3b78d41 100644 (file)
@@ -64,7 +64,7 @@ static int atmel_pit_ofdata_to_platdata(struct udevice *dev)
 {
        struct atmel_pit_platdata *plat = dev_get_platdata(dev);
 
-       plat->regs = (struct atmel_pit_regs *)devfdt_get_addr_ptr(dev);
+       plat->regs = dev_read_addr_ptr(dev);
 
        return 0;
 }
index 939c30999eeb18b24f7a9273520491e731675b0d..80f1d6fd97c8a2d0d8593c4e43275132b9d39a6f 100644 (file)
@@ -25,7 +25,7 @@ static int ehci_zynq_ofdata_to_platdata(struct udevice *dev)
 {
        struct zynq_ehci_priv *priv = dev_get_priv(dev);
 
-       priv->ehci = (struct usb_ehci *)devfdt_get_addr_ptr(dev);
+       priv->ehci = dev_read_addr_ptr(dev);
        if (!priv->ehci)
                return -EINVAL;
 
index a21f9a4d1407d03f9403796073b9bb5b6422818c..9b83d2ad442a08bdd08ee6233b3841203698492e 100644 (file)
@@ -90,7 +90,7 @@ static int ast_wdt_ofdata_to_platdata(struct udevice *dev)
 {
        struct ast_wdt_priv *priv = dev_get_priv(dev);
 
-       priv->regs = devfdt_get_addr_ptr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        if (!priv->regs)
                return -EINVAL;