[RFC PATCH v1 2/4] drivers: use dev_read_addr_ptr when cast to pointer

Johan Jonker jbx6244 at gmail.com
Sun Feb 26 00:05:31 CET 2023



On 2/25/23 20:19, Johan Jonker wrote:
> The fdt_addr_t and phys_addr_t size have been decoupled.
> A 32bit CPU can expect 64-bit data from the device tree parser,
> so use dev_read_addr_ptr instead of the dev_read_addr
> function in the various files in the drivers directory that cast
> to a pointer.
> 
> Signed-off-by: Johan Jonker <jbx6244 at gmail.com>
> ---
> 
> Note:
> 
> This is needed for a Rockchip patch serie to pass the test and
> must be merged before by Rockchip maintainers:
> 
> [PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
> https://lore.kernel.org/u-boot/f3dba231-4a55-0a94-dfab-5cab1419d132@gmail.com/
> 
> Replacement command used:
> find . -type f -exec sed -i 's/*)dev_read_addr(/
>                                *)dev_read_addr_ptr(/g' {} +
> ---
>  drivers/ata/dwc_ahsata.c                       | 2 +-
>  drivers/cache/cache-l2x0.c                     | 2 +-
>  drivers/cache/cache-v5l2.c                     | 2 +-
>  drivers/gpio/mscc_sgpio.c                      | 2 +-
>  drivers/gpio/tegra_gpio.c                      | 4 ++--
>  drivers/gpio/xilinx_gpio.c                     | 2 +-
>  drivers/i2c/i2c-cdns.c                         | 2 +-
>  drivers/i2c/tegra_i2c.c                        | 4 ++--
>  drivers/mmc/am654_sdhci.c                      | 2 +-
>  drivers/mmc/davinci_mmc.c                      | 2 +-
>  drivers/mmc/piton_mmc.c                        | 2 +-
>  drivers/mmc/tegra_mmc.c                        | 2 +-
>  drivers/mmc/zynq_sdhci.c                       | 6 +++---
>  drivers/mtd/nand/raw/arasan_nfc.c              | 2 +-
>  drivers/mtd/nand/raw/cortina_nand.c            | 2 +-
>  drivers/mtd/nand/raw/mxic_nand.c               | 2 +-
>  drivers/mtd/nand/raw/tegra_nand.c              | 2 +-
>  drivers/mtd/nand/raw/zynq_nand.c               | 2 +-
>  drivers/net/mvmdio.c                           | 2 +-
>  drivers/net/qe/dm_qe_uec_phy.c                 | 2 +-
>  drivers/pci/pci-aardvark.c                     | 4 ++--
>  drivers/phy/allwinner/phy-sun50i-usb3.c        | 6 +++---
>  drivers/phy/qcom/phy-qcom-usb-hs-28nm.c        | 4 ++--
>  drivers/phy/qcom/phy-qcom-usb-ss.c             | 4 ++--
>  drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 4 ++--
>  drivers/phy/rockchip/phy-rockchip-typec.c      | 6 +++---
>  drivers/pwm/tegra_pwm.c                        | 2 +-
>  drivers/serial/serial_zynq.c                   | 6 +++---
>  drivers/spi/mpc8xxx_spi.c                      | 2 +-
>  drivers/spi/mscc_bb_spi.c                      | 2 +-
>  drivers/spi/sh_qspi.c                          | 2 +-
>  drivers/spi/spi-mxic.c                         | 2 +-
>  drivers/spi/xilinx_spi.c                       | 2 +-
>  drivers/ufs/ufs.c                              | 2 +-
>  drivers/usb/host/ehci-tegra.c                  | 2 +-
>  drivers/video/dw_mipi_dsi.c                    | 4 ++--
>  drivers/video/rockchip/rk_vop.c                | 2 +-
>  drivers/video/stm32/stm32_dsi.c                | 4 ++--
>  drivers/video/stm32/stm32_ltdc.c               | 4 ++--
>  drivers/video/tegra124/display.c               | 2 +-
>  drivers/video/tegra124/sor.c                   | 6 +++---
>  drivers/watchdog/cdns_wdt.c                    | 6 +++---
>  drivers/watchdog/sp805_wdt.c                   | 6 +++---
>  drivers/watchdog/xilinx_tb_wdt.c               | 6 +++---
>  44 files changed, 69 insertions(+), 69 deletions(-)
> 

[..]

> diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c
> index 6d9c5a94..7c6892cf 100644
> --- a/drivers/video/dw_mipi_dsi.c
> +++ b/drivers/video/dw_mipi_dsi.c
> @@ -800,8 +800,8 @@ static int dw_mipi_dsi_init(struct udevice *dev,
>  	dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
>  	device->host = &dsi->dsi_host;
> 
> -	dsi->base = (void *)dev_read_addr(device->dev);
> -	if ((fdt_addr_t)dsi->base == FDT_ADDR_T_NONE) {
> +	dsi->base = dev_read_addr_ptr(device->dev);

> +	if ((!dsi->base) {

if (!dsi->base) {

Oops typo, sorry..

>  		dev_err(device->dev, "dsi dt register address error\n");
>  		return -EINVAL;
>  	}

[..]
					 0);
> --
> 2.20.1
> 


More information about the U-Boot mailing list