diff mbox series

[2/4] mmc: arm_pl180_mmci: Simplify code using dev_read_addr_ptr()

Message ID 20210706145436.165037-3-stephan@gerhold.net
State Accepted
Commit 19e1da0c66454bd6206a4badfdc0077d7fd76aed
Delegated to: Peng Fan
Headers show
Series Add support for eMMC on ST-Ericsson Ux500(v2) | expand

Commit Message

Stephan Gerhold July 6, 2021, 2:54 p.m. UTC
Simplify the code a bit by using dev_read_addr_ptr() instead of
dev_read_addr(). This avoids having to cast explicitly to void*.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---

 drivers/mmc/arm_pl180_mmci.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Patrice CHOTARD July 8, 2021, 10:09 a.m. UTC | #1
Hi Stephan

On 7/6/21 4:54 PM, Stephan Gerhold wrote:
> Simplify the code a bit by using dev_read_addr_ptr() instead of
> dev_read_addr(). This avoids having to cast explicitly to void*.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
> 
>  drivers/mmc/arm_pl180_mmci.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
> index 5d1ee64356..e632eed03f 100644
> --- a/drivers/mmc/arm_pl180_mmci.c
> +++ b/drivers/mmc/arm_pl180_mmci.c
> @@ -526,14 +526,11 @@ static const struct dm_mmc_ops arm_pl180_dm_mmc_ops = {
>  static int arm_pl180_mmc_of_to_plat(struct udevice *dev)
>  {
>  	struct pl180_mmc_host *host = dev_get_priv(dev);
> -	fdt_addr_t addr;
>  
> -	addr = dev_read_addr(dev);
> -	if (addr == FDT_ADDR_T_NONE)
> +	host->base = dev_read_addr_ptr(dev);
> +	if (!host->base)
>  		return -EINVAL;
>  
> -	host->base = (void *)addr;
> -
>  	return 0;
>  }
>  
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com> on stm32f769-disco

Thanks
Patrice
Jaehoon Chung July 9, 2021, 9:30 a.m. UTC | #2
On 7/6/21 11:54 PM, Stephan Gerhold wrote:
> Simplify the code a bit by using dev_read_addr_ptr() instead of
> dev_read_addr(). This avoids having to cast explicitly to void*.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
> 
>  drivers/mmc/arm_pl180_mmci.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
> index 5d1ee64356..e632eed03f 100644
> --- a/drivers/mmc/arm_pl180_mmci.c
> +++ b/drivers/mmc/arm_pl180_mmci.c
> @@ -526,14 +526,11 @@ static const struct dm_mmc_ops arm_pl180_dm_mmc_ops = {
>  static int arm_pl180_mmc_of_to_plat(struct udevice *dev)
>  {
>  	struct pl180_mmc_host *host = dev_get_priv(dev);
> -	fdt_addr_t addr;
>  
> -	addr = dev_read_addr(dev);
> -	if (addr == FDT_ADDR_T_NONE)
> +	host->base = dev_read_addr_ptr(dev);
> +	if (!host->base)
>  		return -EINVAL;
>  
> -	host->base = (void *)addr;
> -
>  	return 0;
>  }
>  
>
diff mbox series

Patch

diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index 5d1ee64356..e632eed03f 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -526,14 +526,11 @@  static const struct dm_mmc_ops arm_pl180_dm_mmc_ops = {
 static int arm_pl180_mmc_of_to_plat(struct udevice *dev)
 {
 	struct pl180_mmc_host *host = dev_get_priv(dev);
-	fdt_addr_t addr;
 
-	addr = dev_read_addr(dev);
-	if (addr == FDT_ADDR_T_NONE)
+	host->base = dev_read_addr_ptr(dev);
+	if (!host->base)
 		return -EINVAL;
 
-	host->base = (void *)addr;
-
 	return 0;
 }