treewide: convert devfdt_get_addr_ptr() to dev_read_addr_ptr()

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>
diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c
index 284f5f5..d1940f1 100644
--- a/drivers/clk/aspeed/clk_ast2500.c
+++ b/drivers/clk/aspeed/clk_ast2500.c
@@ -497,7 +497,7 @@
 {
 	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;
 
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 54ae0d2..ca90abe 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -41,7 +41,7 @@
 
 	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 @@
 	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;
 }
diff --git a/drivers/gpio/hsdk-creg-gpio.c b/drivers/gpio/hsdk-creg-gpio.c
index d9df804..35b1149 100644
--- a/drivers/gpio/hsdk-creg-gpio.c
+++ b/drivers/gpio/hsdk-creg-gpio.c
@@ -83,7 +83,7 @@
 	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);
diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c
index 253e653..2cdfb55 100644
--- a/drivers/i2c/ast_i2c.c
+++ b/drivers/i2c/ast_i2c.c
@@ -92,7 +92,7 @@
 	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;
 
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index cf892c6..569a5d3 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -768,7 +768,7 @@
 	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);
diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c
index 59675d8..82e8fda 100644
--- a/drivers/i2c/mv_i2c.c
+++ b/drivers/i2c/mv_i2c.c
@@ -580,7 +580,7 @@
 {
 	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;
 }
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index d3cc9b9..fdb8fd4 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -798,7 +798,7 @@
 {
 	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 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))
diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c
index 9d20e28..0a347b2 100644
--- a/drivers/mmc/gen_atmel_mci.c
+++ b/drivers/mmc/gen_atmel_mci.c
@@ -592,7 +592,7 @@
 	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);
 
diff --git a/drivers/mmc/snps_dw_mmc.c b/drivers/mmc/snps_dw_mmc.c
index c606ef0..4b468a1 100644
--- a/drivers/mmc/snps_dw_mmc.c
+++ b/drivers/mmc/snps_dw_mmc.c
@@ -83,7 +83,7 @@
 	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
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index ac0377e..146f5c6 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -193,7 +193,7 @@
 		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;
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 830eda9..1849db4 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -118,7 +118,7 @@
 	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;
diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c
index 7e4cd6c..fb43f88 100644
--- a/drivers/serial/serial_mvebu_a3700.c
+++ b/drivers/serial/serial_mvebu_a3700.c
@@ -104,7 +104,7 @@
 {
 	struct mvebu_platdata *plat = dev_get_platdata(dev);
 
-	plat->base = devfdt_get_addr_ptr(dev);
+	plat->base = dev_read_addr_ptr(dev);
 
 	return 0;
 }
diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c
index 114bd8a..b645668 100644
--- a/drivers/spi/uniphier_spi.c
+++ b/drivers/spi/uniphier_spi.c
@@ -368,7 +368,7 @@
 	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);
diff --git a/drivers/sysreset/sysreset_socfpga.c b/drivers/sysreset/sysreset_socfpga.c
index 178bcb2..67cec65 100644
--- a/drivers/sysreset/sysreset_socfpga.c
+++ b/drivers/sysreset/sysreset_socfpga.c
@@ -40,7 +40,7 @@
 {
 	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;
 }
 
diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c
index 9f28cbf..e313249 100644
--- a/drivers/timer/ast_timer.c
+++ b/drivers/timer/ast_timer.c
@@ -64,7 +64,7 @@
 {
 	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;
 
diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c
index 7051169..843d670 100644
--- a/drivers/timer/atmel_pit_timer.c
+++ b/drivers/timer/atmel_pit_timer.c
@@ -64,7 +64,7 @@
 {
 	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;
 }
diff --git a/drivers/usb/host/ehci-zynq.c b/drivers/usb/host/ehci-zynq.c
index 939c309..80f1d6f 100644
--- a/drivers/usb/host/ehci-zynq.c
+++ b/drivers/usb/host/ehci-zynq.c
@@ -25,7 +25,7 @@
 {
 	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;
 
diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c
index a21f9a4..9b83d2a 100644
--- a/drivers/watchdog/ast_wdt.c
+++ b/drivers/watchdog/ast_wdt.c
@@ -90,7 +90,7 @@
 {
 	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;