Message ID | 20200804051443.1074096-3-yamada.masahiro@socionext.com |
---|---|
State | New |
Headers | show |
Series | [1/3] gpio: at91: use dev_read_addr() to get base address | expand |
On Mon, 3 Aug 2020 at 23:15, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > 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> > --- > > drivers/clk/aspeed/clk_ast2500.c | 2 +- > drivers/clk/at91/pmc.c | 4 ++-- > drivers/gpio/hsdk-creg-gpio.c | 2 +- > drivers/i2c/ast_i2c.c | 2 +- > drivers/i2c/designware_i2c.c | 2 +- > drivers/i2c/mv_i2c.c | 2 +- > drivers/i2c/mvtwsi.c | 4 ++-- > drivers/mmc/gen_atmel_mci.c | 2 +- > drivers/mmc/snps_dw_mmc.c | 2 +- > drivers/pinctrl/mvebu/pinctrl-mvebu.c | 2 +- > drivers/reset/reset-socfpga.c | 2 +- > drivers/serial/serial_mvebu_a3700.c | 2 +- > drivers/spi/uniphier_spi.c | 2 +- > drivers/sysreset/sysreset_socfpga.c | 2 +- > drivers/timer/ast_timer.c | 2 +- > drivers/timer/atmel_pit_timer.c | 2 +- > drivers/usb/host/ehci-zynq.c | 2 +- > drivers/watchdog/ast_wdt.c | 2 +- > 18 files changed, 20 insertions(+), 20 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Mon, 3 Aug 2020 at 23:15, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > 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> > --- > > drivers/clk/aspeed/clk_ast2500.c | 2 +- > drivers/clk/at91/pmc.c | 4 ++-- > drivers/gpio/hsdk-creg-gpio.c | 2 +- > drivers/i2c/ast_i2c.c | 2 +- > drivers/i2c/designware_i2c.c | 2 +- > drivers/i2c/mv_i2c.c | 2 +- > drivers/i2c/mvtwsi.c | 4 ++-- > drivers/mmc/gen_atmel_mci.c | 2 +- > drivers/mmc/snps_dw_mmc.c | 2 +- > drivers/pinctrl/mvebu/pinctrl-mvebu.c | 2 +- > drivers/reset/reset-socfpga.c | 2 +- > drivers/serial/serial_mvebu_a3700.c | 2 +- > drivers/spi/uniphier_spi.c | 2 +- > drivers/sysreset/sysreset_socfpga.c | 2 +- > drivers/timer/ast_timer.c | 2 +- > drivers/timer/atmel_pit_timer.c | 2 +- > drivers/usb/host/ehci-zynq.c | 2 +- > drivers/watchdog/ast_wdt.c | 2 +- > 18 files changed, 20 insertions(+), 20 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot-dm, thanks!
diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c index ccfeded30c..1414d26a53 100644 --- a/drivers/clk/aspeed/clk_ast2500.c +++ b/drivers/clk/aspeed/clk_ast2500.c @@ -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 (IS_ERR(priv->scu)) return PTR_ERR(priv->scu); diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index 54ae0d281d..ca90abef2d 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -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; } diff --git a/drivers/gpio/hsdk-creg-gpio.c b/drivers/gpio/hsdk-creg-gpio.c index d9df804f63..35b114904d 100644 --- a/drivers/gpio/hsdk-creg-gpio.c +++ b/drivers/gpio/hsdk-creg-gpio.c @@ -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); diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c index 214362d04b..d122157591 100644 --- a/drivers/i2c/ast_i2c.c +++ b/drivers/i2c/ast_i2c.c @@ -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 (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index cf892c69d9..569a5d39b4 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -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); diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c index 59675d8d57..82e8fdac41 100644 --- a/drivers/i2c/mv_i2c.c +++ b/drivers/i2c/mv_i2c.c @@ -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; } diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c index d3cc9b9d83..fdb8fd42e5 100644 --- a/drivers/i2c/mvtwsi.c +++ b/drivers/i2c/mvtwsi.c @@ -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)) diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index 9d20e28383..0a347b2fb2 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -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); diff --git a/drivers/mmc/snps_dw_mmc.c b/drivers/mmc/snps_dw_mmc.c index c606ef011b..4b468a1f3d 100644 --- a/drivers/mmc/snps_dw_mmc.c +++ b/drivers/mmc/snps_dw_mmc.c @@ -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 diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index 2206e958ec..37707a6319 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -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 == (void *)FDT_ADDR_T_NONE) { 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 830eda9430..1849db4da9 100644 --- a/drivers/reset/reset-socfpga.c +++ b/drivers/reset/reset-socfpga.c @@ -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; diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c index 7e4cd6c4b4..fb43f88eaf 100644 --- a/drivers/serial/serial_mvebu_a3700.c +++ b/drivers/serial/serial_mvebu_a3700.c @@ -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; } diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c index 114bd8abd7..b6456685f8 100644 --- a/drivers/spi/uniphier_spi.c +++ b/drivers/spi/uniphier_spi.c @@ -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); diff --git a/drivers/sysreset/sysreset_socfpga.c b/drivers/sysreset/sysreset_socfpga.c index 178bcb227f..67cec6563a 100644 --- a/drivers/sysreset/sysreset_socfpga.c +++ b/drivers/sysreset/sysreset_socfpga.c @@ -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; } diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 3838601f54..4322f05e9f 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c @@ -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 (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c index 70511697fe..843d670b5e 100644 --- a/drivers/timer/atmel_pit_timer.c +++ b/drivers/timer/atmel_pit_timer.c @@ -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; } diff --git a/drivers/usb/host/ehci-zynq.c b/drivers/usb/host/ehci-zynq.c index 939c30999e..80f1d6fd97 100644 --- a/drivers/usb/host/ehci-zynq.c +++ b/drivers/usb/host/ehci-zynq.c @@ -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; diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c index 7e11465a57..b4aef545e8 100644 --- a/drivers/watchdog/ast_wdt.c +++ b/drivers/watchdog/ast_wdt.c @@ -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 (IS_ERR(priv->regs)) return PTR_ERR(priv->regs);
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> --- drivers/clk/aspeed/clk_ast2500.c | 2 +- drivers/clk/at91/pmc.c | 4 ++-- drivers/gpio/hsdk-creg-gpio.c | 2 +- drivers/i2c/ast_i2c.c | 2 +- drivers/i2c/designware_i2c.c | 2 +- drivers/i2c/mv_i2c.c | 2 +- drivers/i2c/mvtwsi.c | 4 ++-- drivers/mmc/gen_atmel_mci.c | 2 +- drivers/mmc/snps_dw_mmc.c | 2 +- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 2 +- drivers/reset/reset-socfpga.c | 2 +- drivers/serial/serial_mvebu_a3700.c | 2 +- drivers/spi/uniphier_spi.c | 2 +- drivers/sysreset/sysreset_socfpga.c | 2 +- drivers/timer/ast_timer.c | 2 +- drivers/timer/atmel_pit_timer.c | 2 +- drivers/usb/host/ehci-zynq.c | 2 +- drivers/watchdog/ast_wdt.c | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) -- 2.25.1