Skip to content

Commit

Permalink
treewide: convert devfdt_get_addr() to dev_read_addr()
Browse files Browse the repository at this point in the history
When you enable CONFIG_OF_LIVE, you will end up with a lot of
conversions.

To generate this commit, I used coccinelle excluding drivers/core/,
include/dm/, and test/

The semantic patch that makes this change is as follows:

  <smpl>
  @@
  expression dev;
  @@
  -devfdt_get_addr(dev)
  +dev_read_addr(dev)
  </smpl>

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y authored and sjg20 committed Jul 25, 2020
1 parent cf081a5 commit 2548493
Show file tree
Hide file tree
Showing 120 changed files with 125 additions and 125 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-snapdragon/clock-snapdragon.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int msm_clk_probe(struct udevice *dev)
{
struct msm_clk_priv *priv = dev_get_priv(dev);

priv->base = devfdt_get_addr(dev);
priv->base = dev_read_addr(dev);
if (priv->base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-snapdragon/pinctrl-snapdragon.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static int msm_pinctrl_probe(struct udevice *dev)
{
struct msm_pinctrl_priv *priv = dev_get_priv(dev);

priv->base = devfdt_get_addr(dev);
priv->base = dev_read_addr(dev);
priv->data = (struct msm_pinctrl_data *)dev->driver_data;

return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/dwc_ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static int dwc_ahci_ofdata_to_platdata(struct udevice *dev)
struct dwc_ahci_priv *priv = dev_get_priv(dev);
fdt_addr_t addr;

priv->base = map_physmem(devfdt_get_addr(dev), sizeof(void *),
priv->base = map_physmem(dev_read_addr(dev), sizeof(void *),
MAP_NOCACHE);

addr = devfdt_get_addr_index(dev, 1);
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/altera/clk-agilex.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static int socfpga_clk_ofdata_to_platdata(struct udevice *dev)
struct socfpga_clk_platdata *plat = dev_get_platdata(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
plat->regs = (void __iomem *)addr;
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/altera/clk-arria10.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static int socfpga_a10_clk_probe(struct udevice *dev)
socfpga_a10_handoff_workaround(dev);

if (!fdt_node_check_compatible(fdt, offset, "altr,clk-mgr")) {
plat->regs = devfdt_get_addr(dev);
plat->regs = dev_read_addr(dev);
} else {
pdev = dev_get_parent(dev);
if (!pdev)
Expand Down
4 changes: 2 additions & 2 deletions drivers/clk/exynos/clk-exynos7420.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int exynos7420_clk_topc_probe(struct udevice *dev)
fdt_addr_t base;
int ret;

base = devfdt_get_addr(dev);
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down Expand Up @@ -149,7 +149,7 @@ static int exynos7420_clk_top0_probe(struct udevice *dev)
if (!priv)
return -EINVAL;

base = devfdt_get_addr(dev);
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/uniphier/clk-uniphier-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static int uniphier_clk_probe(struct udevice *dev)
struct uniphier_clk_priv *priv = dev_get_priv(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev->parent);
addr = dev_read_addr(dev->parent);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/ti-edma3.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ static int ti_edma3_ofdata_to_platdata(struct udevice *dev)
{
struct ti_edma3_priv *priv = dev_get_priv(dev);

priv->base = devfdt_get_addr(dev);
priv->base = dev_read_addr(dev);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/altera_pio.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static int altera_pio_ofdata_to_platdata(struct udevice *dev)
{
struct altera_pio_platdata *plat = dev_get_platdata(dev);

plat->regs = map_physmem(devfdt_get_addr(dev),
plat->regs = map_physmem(dev_read_addr(dev),
sizeof(struct altera_pio_regs),
MAP_NOCACHE);
plat->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/atmel_pio4.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static int atmel_pio4_probe(struct udevice *dev)

clk_free(&clk);

addr_base = devfdt_get_addr(dev);
addr_base = dev_read_addr(dev);
if (addr_base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/bcm2835_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static int bcm2835_gpio_ofdata_to_platdata(struct udevice *dev)
struct bcm2835_gpio_platdata *plat = dev_get_platdata(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/da8xx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ static int davinci_gpio_ofdata_to_platdata(struct udevice *dev)
struct davinci_gpio_platdata *plat = dev_get_platdata(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-rza1.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static int r7s72100_gpio_probe(struct udevice *dev)

uc_priv->bank_name = dev->name;
dev = dev_get_parent(dev);
addr_base = devfdt_get_addr(dev);
addr_base = dev_read_addr(dev);
if (addr_base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-uniphier.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static int uniphier_gpio_probe(struct udevice *dev)
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/msm_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int msm_gpio_probe(struct udevice *dev)
{
struct msm_gpio_bank *priv = dev_get_priv(dev);

priv->base = devfdt_get_addr(dev);
priv->base = dev_read_addr(dev);

return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/mxc_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static int mxc_gpio_ofdata_to_platdata(struct udevice *dev)
fdt_addr_t addr;
struct mxc_gpio_plat *plat = dev_get_platdata(dev);

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/mxs_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static int mxs_ofdata_to_platdata(struct udevice *dev)
int node = dev_of_offset(dev);
int ret;

plat->bank = devfdt_get_addr(dev);
plat->bank = dev_read_addr(dev);
if (plat->bank == FDT_ADDR_T_NONE) {
printf("%s: No 'reg' property defined!\n", __func__);
return -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpio/omap_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ static int omap_gpio_bind(struct udevice *dev)
if (plat)
return 0;

base_addr = devfdt_get_addr(dev);
base_addr = dev_read_addr(dev);
if (base_addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down Expand Up @@ -347,7 +347,7 @@ static int omap_gpio_ofdata_to_platdata(struct udevice *dev)
struct omap_gpio_platdata *plat = dev_get_platdata(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/pm8916_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static int pm8941_pwrkey_probe(struct udevice *dev)
struct pm8916_gpio_bank *priv = dev_get_priv(dev);
int reg;

priv->pid = devfdt_get_addr(dev);
priv->pid = dev_read_addr(dev);
if (priv->pid == FDT_ADDR_T_NONE)
return log_msg_ret("bad address", -EINVAL);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/s5p_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static int gpio_exynos_bind(struct udevice *parent)

dev_set_of_offset(dev, node);

reg = devfdt_get_addr(dev);
reg = dev_read_addr(dev);
if (reg != FDT_ADDR_T_NONE)
bank = (struct s5p_gpio_bank *)((ulong)base + reg);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/sifive-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static int sifive_gpio_ofdata_to_platdata(struct udevice *dev)
struct sifive_gpio_platdata *plat = dev_get_platdata(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/vybrid_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int vybrid_gpio_odata_to_platdata(struct udevice *dev)
struct vybrid_gpio_platdata *plat = dev_get_platdata(dev);
fdt_addr_t base_addr;

base_addr = devfdt_get_addr(dev);
base_addr = dev_read_addr(dev);
if (base_addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/i2c-uniphier-f.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static int uniphier_fi2c_probe(struct udevice *dev)
fdt_addr_t addr;
struct uniphier_fi2c_priv *priv = dev_get_priv(dev);

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/i2c-uniphier.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static int uniphier_i2c_probe(struct udevice *dev)
fdt_addr_t addr;
struct uniphier_i2c_priv *priv = dev_get_priv(dev);

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/imx_lpi2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static int imx_lpi2c_probe(struct udevice *bus)

i2c_bus->driver_data = dev_get_driver_data(bus);

addr = devfdt_get_addr(bus);
addr = dev_read_addr(bus);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/iproc_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ static int iproc_i2c_ofdata_to_platdata(struct udevice *bus)
int node = dev_of_offset(bus);
const void *blob = gd->fdt_blob;

bus_prvdata->base = map_physmem(devfdt_get_addr(bus),
bus_prvdata->base = map_physmem(dev_read_addr(bus),
sizeof(void *),
MAP_NOCACHE);

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/mxc_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ static int mxc_i2c_probe(struct udevice *bus)

i2c_bus->driver_data = dev_get_driver_data(bus);

addr = devfdt_get_addr(bus);
addr = dev_read_addr(bus);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/omap24xx_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ static int omap_i2c_ofdata_to_platdata(struct udevice *bus)
{
struct omap_i2c_platdata *plat = dev_get_platdata(bus);

plat->base = devfdt_get_addr(bus);
plat->base = dev_read_addr(bus);
plat->speed = dev_read_u32_default(bus, "clock-frequency",
I2C_SPEED_STANDARD_RATE);
plat->ip_rev = dev_get_driver_data(bus);
Expand Down
2 changes: 1 addition & 1 deletion drivers/mailbox/tegra-hsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static int tegra_hsp_probe(struct udevice *dev)

debug("%s(dev=%p)\n", __func__, dev);

thsp->regs = devfdt_get_addr(dev);
thsp->regs = dev_read_addr(dev);
if (thsp->regs == FDT_ADDR_T_NONE)
return -ENODEV;

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/altera_sysid.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static int altera_sysid_ofdata_to_platdata(struct udevice *dev)
{
struct altera_sysid_platdata *plat = dev_get_platdata(dev);

plat->regs = map_physmem(devfdt_get_addr(dev),
plat->regs = map_physmem(dev_read_addr(dev),
sizeof(struct altera_sysid_regs),
MAP_NOCACHE);

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/imx8/scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static int imx8_scu_probe(struct udevice *dev)

debug("%s(dev=%p) (plat=%p)\n", __func__, dev, plat);

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/microchip_flexcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static int microchip_flexcom_ofdata_to_platdata(struct udevice *dev)
struct microchip_flexcom_platdata *plat = dev_get_platdata(dev);
int ret;

plat->regs = map_physmem(devfdt_get_addr(dev),
plat->regs = map_physmem(dev_read_addr(dev),
sizeof(struct microchip_flexcom_regs),
MAP_NOCACHE);

Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/bcm2835_sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static int bcm2835_sdhci_probe(struct udevice *dev)
int ret;
int clock_id = (int)dev_get_driver_data(dev);

base = devfdt_get_addr(dev);
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/bcm2835_sdhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ static int bcm2835_probe(struct udevice *dev)
upriv->mmc = &plat->mmc;
plat->cfg.name = dev->name;

host->phys_addr = devfdt_get_addr(dev);
host->phys_addr = dev_read_addr(dev);
if (host->phys_addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/bcmstb_sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static int sdhci_bcmstb_probe(struct udevice *dev)
fdt_addr_t base;
int ret;

base = devfdt_get_addr(dev);
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/jz_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static int jz_mmc_ofdata_to_platdata(struct udevice *dev)
struct mmc_config *cfg;
int ret;

priv->regs = map_physmem(devfdt_get_addr(dev), 0x100, MAP_NOCACHE);
priv->regs = map_physmem(dev_read_addr(dev), 0x100, MAP_NOCACHE);
cfg = &plat->cfg;

cfg->name = "MSC";
Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/meson_gx_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static int meson_mmc_ofdata_to_platdata(struct udevice *dev)
struct meson_mmc_platdata *pdata = dev_get_platdata(dev);
fdt_addr_t addr;

addr = devfdt_get_addr(dev);
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
4 changes: 2 additions & 2 deletions drivers/mmc/omap_hsmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
int node = dev_of_offset(dev);
int ret;

plat->base_addr = map_physmem(devfdt_get_addr(dev),
plat->base_addr = map_physmem(dev_read_addr(dev),
sizeof(struct hsmmc *),
MAP_NOCACHE);

Expand All @@ -1933,7 +1933,7 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
plat->controller_flags |= of_data->controller_flags;

#ifdef CONFIG_OMAP54XX
fixups = platform_fixups_mmc(devfdt_get_addr(dev));
fixups = platform_fixups_mmc(dev_read_addr(dev));
if (fixups) {
plat->hw_rev = fixups->hw_rev;
cfg->host_caps &= ~fixups->unsupported_caps;
Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/sdhci-cadence.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static int sdhci_cdns_probe(struct udevice *dev)
fdt_addr_t base;
int ret;

base = devfdt_get_addr(dev);
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/sh_mmcif.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ static int sh_mmcif_dm_probe(struct udevice *dev)
fdt_addr_t base;
int ret;

base = devfdt_get_addr(dev);
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/sh_sdhi.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ static int sh_sdhi_dm_probe(struct udevice *dev)
fdt_addr_t base;
int ret;

base = devfdt_get_addr(dev);
base = dev_read_addr(dev);
if (base == FDT_ADDR_T_NONE)
return -EINVAL;

Expand Down
Loading

0 comments on commit 2548493

Please sign in to comment.