diff mbox

[U-Boot,V5,1/4] spi: fsl_qspi: fix compile warning for 64-bit platform

Message ID 1453347252-1579-1-git-send-email-Qianyu.Gong@nxp.com
State Accepted
Commit c2a4cb17b4ff194e905df76b9f7c1b5a00b99b25
Delegated to: York Sun
Headers show

Commit Message

Gong Qianyu Jan. 21, 2016, 3:34 a.m. UTC
From: Gong Qianyu <Qianyu.Gong@freescale.com>

This patch fixes the following compile warning:
drivers/spi/fsl_qspi.c: In function 'fsl_qspi_probe':
drivers/spi/fsl_qspi.c:937:15:
  warning: cast to pointer from integer of different size
					 [-Wint-to-pointer-cast]
  priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
               ^
Just make the cast explicit.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
---
V5:
 - Use uintptr_t instead of unsigned long.
V4:
 - Revise the commit message.
V2-V3:
 - No change.

 drivers/spi/fsl_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Scott Wood Jan. 21, 2016, 7:28 p.m. UTC | #1
On 01/20/2016 09:42 PM, Gong Qianyu wrote:
> From: Gong Qianyu <Qianyu.Gong@freescale.com>
> 
> This patch fixes the following compile warning:
> drivers/spi/fsl_qspi.c: In function 'fsl_qspi_probe':
> drivers/spi/fsl_qspi.c:937:15:
>   warning: cast to pointer from integer of different size
> 					 [-Wint-to-pointer-cast]
>   priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
>                ^
> Just make the cast explicit.
> 
> Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
> ---
> V5:
>  - Use uintptr_t instead of unsigned long.
> V4:
>  - Revise the commit message.
> V2-V3:
>  - No change.
> 
>  drivers/spi/fsl_qspi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
> index 542b6cf..38e5900 100644
> --- a/drivers/spi/fsl_qspi.c
> +++ b/drivers/spi/fsl_qspi.c
> @@ -936,7 +936,7 @@ static int fsl_qspi_probe(struct udevice *bus)
>  
>  	dm_spi_bus->max_hz = plat->speed_hz;
>  
> -	priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
> +	priv->regs = (struct fsl_qspi_regs *)(uintptr_t)plat->reg_base;
>  	priv->flags = plat->flags;
>  
>  	priv->speed_hz = plat->speed_hz;
> 

Use phys_to_virt().

-Scott
Gong Qianyu Jan. 22, 2016, 4:08 a.m. UTC | #2
> -----Original Message-----
> From: Scott Wood
> Sent: Friday, January 22, 2016 3:28 AM
> To: Qianyu Gong <qianyu.gong@nxp.com>; u-boot@lists.denx.de;
> R58495@freescale.com
> Cc: Mingkai.Hu@freescale.com; jteki@openedev.com; B48286@freescale.com;
> Shaohui.Xie@freescale.com; Wenbin.Song@freescale.com; Scott Wood
> <oss@buserror.net>; Gong Qianyu <Qianyu.Gong@freescale.com>
> Subject: Re: [Patch V5 1/4] spi: fsl_qspi: fix compile warning for 64-bit platform
> 
> On 01/20/2016 09:42 PM, Gong Qianyu wrote:
> > From: Gong Qianyu <Qianyu.Gong@freescale.com>
> >
> > This patch fixes the following compile warning:
> > drivers/spi/fsl_qspi.c: In function 'fsl_qspi_probe':
> > drivers/spi/fsl_qspi.c:937:15:
> >   warning: cast to pointer from integer of different size
> > 					 [-Wint-to-pointer-cast]
> >   priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
> >                ^
> > Just make the cast explicit.
> >
> > Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
> > ---
> > V5:
> >  - Use uintptr_t instead of unsigned long.
> > V4:
> >  - Revise the commit message.
> > V2-V3:
> >  - No change.
> >
> >  drivers/spi/fsl_qspi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c index
> > 542b6cf..38e5900 100644
> > --- a/drivers/spi/fsl_qspi.c
> > +++ b/drivers/spi/fsl_qspi.c
> > @@ -936,7 +936,7 @@ static int fsl_qspi_probe(struct udevice *bus)
> >
> >  	dm_spi_bus->max_hz = plat->speed_hz;
> >
> > -	priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
> > +	priv->regs = (struct fsl_qspi_regs *)(uintptr_t)plat->reg_base;
> >  	priv->flags = plat->flags;
> >
> >  	priv->speed_hz = plat->speed_hz;
> >
> 
> Use phys_to_virt().
> 
> -Scott

The function seems to be dropped in U-Boot? 
I just find it in arch/arm/include/asm/memory.h with ''#if 0''.

Regards,
Qianyu
diff mbox

Patch

diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 542b6cf..38e5900 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -936,7 +936,7 @@  static int fsl_qspi_probe(struct udevice *bus)
 
 	dm_spi_bus->max_hz = plat->speed_hz;
 
-	priv->regs = (struct fsl_qspi_regs *)plat->reg_base;
+	priv->regs = (struct fsl_qspi_regs *)(uintptr_t)plat->reg_base;
 	priv->flags = plat->flags;
 
 	priv->speed_hz = plat->speed_hz;