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

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 explict.
Signed-off-by: Gong Qianyu Qianyu.Gong@freescale.com --- 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 feec3e8..9f23c10 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 *)(unsigned long)plat->reg_base; priv->flags = plat->flags;
priv->speed_hz = plat->speed_hz;

On 01/10/2016 06:14 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 explict.
Signed-off-by: Gong Qianyu Qianyu.Gong@freescale.com
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 feec3e8..9f23c10 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;
The reg_base is u32. Is it always correct on 64-bit SoC?
- priv->regs = (struct fsl_qspi_regs *)(unsigned long)plat->reg_base;
How about (struct fsl_qspi_regs *)(uintptr_t)plat->reg_base?
York

-----Original Message----- From: york sun Sent: Wednesday, January 20, 2016 2:42 AM To: Qianyu Gong qianyu.gong@nxp.com; u-boot@lists.denx.de Cc: Mingkai Hu mingkai.hu@nxp.com; jteki@openedev.com; Yao Yuan yao.yuan@nxp.com; R58495@freescale.com; Gong Qianyu Qianyu.Gong@freescale.com Subject: Re: [Patch V4 1/4] spi: fsl_qspi: fix compile warning for 64-bit platform
On 01/10/2016 06:14 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 explict.
Signed-off-by: Gong Qianyu Qianyu.Gong@freescale.com
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 feec3e8..9f23c10 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;
The reg_base is u32. Is it always correct on 64-bit SoC?
So far it's always a u32 type of CCSR address.
- priv->regs = (struct fsl_qspi_regs *)(unsigned long)plat->reg_base;
How about (struct fsl_qspi_regs *)(uintptr_t)plat->reg_base?
York
The size of ''unsigned long'' depends on compilers. It works well with GCC.
Looks the same. But not sure what is defining CONFIG_USE_STDIN for.
#ifdef CONFIG_USE_STDIN /* Provided by gcc. */ #include <stdint.h> #else /* Type for `void *' pointers. */ typedef unsigned long int uintptr_t; #endif
Regards, Qianyu

On 01/19/2016 08:03 PM, Qianyu Gong wrote:
-----Original Message----- From: york sun Sent: Wednesday, January 20, 2016 2:42 AM To: Qianyu Gong qianyu.gong@nxp.com; u-boot@lists.denx.de Cc: Mingkai Hu mingkai.hu@nxp.com; jteki@openedev.com; Yao Yuan yao.yuan@nxp.com; R58495@freescale.com; Gong Qianyu Qianyu.Gong@freescale.com Subject: Re: [Patch V4 1/4] spi: fsl_qspi: fix compile warning for 64-bit platform
On 01/10/2016 06:14 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 explict.
Signed-off-by: Gong Qianyu Qianyu.Gong@freescale.com
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 feec3e8..9f23c10 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;
The reg_base is u32. Is it always correct on 64-bit SoC?
So far it's always a u32 type of CCSR address.
- priv->regs = (struct fsl_qspi_regs *)(unsigned long)plat->reg_base;
How about (struct fsl_qspi_regs *)(uintptr_t)plat->reg_base?
York
The size of ''unsigned long'' depends on compilers. It works well with GCC.
Looks the same. But not sure what is defining CONFIG_USE_STDIN for.
#ifdef CONFIG_USE_STDIN /* Provided by gcc. */ #include <stdint.h> #else /* Type for `void *' pointers. */ typedef unsigned long int uintptr_t; #endif
uintptr_t is specifically defined for this type of use. You can grep it in u-boot to see examples.
York

Hi York,
-----Original Message----- From: york sun Sent: Thursday, January 21, 2016 4:23 AM To: Qianyu Gong qianyu.gong@nxp.com; u-boot@lists.denx.de Cc: Mingkai Hu mingkai.hu@nxp.com; jteki@openedev.com; Yao Yuan yao.yuan@nxp.com; R58495@freescale.com; Gong Qianyu Qianyu.Gong@freescale.com Subject: Re: [Patch V4 1/4] spi: fsl_qspi: fix compile warning for 64-bit platform
On 01/19/2016 08:03 PM, Qianyu Gong wrote:
-----Original Message----- From: york sun Sent: Wednesday, January 20, 2016 2:42 AM To: Qianyu Gong qianyu.gong@nxp.com; u-boot@lists.denx.de Cc: Mingkai Hu mingkai.hu@nxp.com; jteki@openedev.com; Yao Yuan yao.yuan@nxp.com; R58495@freescale.com; Gong Qianyu Qianyu.Gong@freescale.com Subject: Re: [Patch V4 1/4] spi: fsl_qspi: fix compile warning for 64-bit platform
On 01/10/2016 06:14 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 explict.
Signed-off-by: Gong Qianyu Qianyu.Gong@freescale.com
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 feec3e8..9f23c10 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;
The reg_base is u32. Is it always correct on 64-bit SoC?
So far it's always a u32 type of CCSR address.
- priv->regs = (struct fsl_qspi_regs *)(unsigned
+long)plat->reg_base;
How about (struct fsl_qspi_regs *)(uintptr_t)plat->reg_base?
York
The size of ''unsigned long'' depends on compilers. It works well with GCC.
Looks the same. But not sure what is defining CONFIG_USE_STDIN for.
#ifdef CONFIG_USE_STDIN /* Provided by gcc. */ #include <stdint.h> #else /* Type for `void *' pointers. */ typedef unsigned long int uintptr_t; #endif
uintptr_t is specifically defined for this type of use. You can grep it in u-boot to see examples.
York
Thanks! I've sent out a new version of the patch set.
Regards, Qianyu
participants (3)
-
Gong Qianyu
-
Qianyu Gong
-
york sun