mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings
@ 2022-10-19  6:34 ruanjinjie
  2022-10-29  1:01 ` Ruan Jinjie
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ruanjinjie @ 2022-10-19  6:34 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, joel, Julia.Lawall, linuxppc-dev,
	linux-kernel
  Cc: ruanjinjie

When build Linux kernel, encounter the following warnings:

./arch/powerpc/sysdev/mpic_msgr.c:230:38: warning: cast removes address space '__iomem' of expression
./arch/powerpc/sysdev/mpic_msgr.c:230:27: warning: incorrect type in assignment (different address spaces)

The data type of msgr->mer and msgr->base are 'u32 __iomem *', but
converted to 'u32 *' and 'u8 *' directly and cause above warnings, now
instead of using a type cast, change the size of the pointer offset to fix
these warnings.

Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
---
v2:
- change the macro of MPIC_MSGR_MER_OFFSET to avoid type cast and
  simplify the fix
---
 arch/powerpc/sysdev/mpic_msgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index a439e33eae06..d75064fb7d12 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -20,7 +20,7 @@
 
 #define MPIC_MSGR_REGISTERS_PER_BLOCK	4
 #define MPIC_MSGR_STRIDE		0x10
-#define MPIC_MSGR_MER_OFFSET		0x100
+#define MPIC_MSGR_MER_OFFSET		(0x100 / sizeof(u32))
 #define MSGR_INUSE			0
 #define MSGR_FREE			1
 
@@ -234,7 +234,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
 
 		reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i;
 		msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE;
-		msgr->mer = (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET);
+		msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;
 		msgr->in_use = MSGR_FREE;
 		msgr->num = i;
 		raw_spin_lock_init(&msgr->lock);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings
  2022-10-19  6:34 [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings ruanjinjie
@ 2022-10-29  1:01 ` Ruan Jinjie
  2022-11-02  8:34 ` Christophe Leroy
  2022-11-30  9:24 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Ruan Jinjie @ 2022-10-29  1:01 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, joel, Julia.Lawall, linuxppc-dev,
	linux-kernel

Ping.

On 2022/10/19 14:34, ruanjinjie wrote:
> When build Linux kernel, encounter the following warnings:
> 
> ./arch/powerpc/sysdev/mpic_msgr.c:230:38: warning: cast removes address space '__iomem' of expression
> ./arch/powerpc/sysdev/mpic_msgr.c:230:27: warning: incorrect type in assignment (different address spaces)
> 
> The data type of msgr->mer and msgr->base are 'u32 __iomem *', but
> converted to 'u32 *' and 'u8 *' directly and cause above warnings, now
> instead of using a type cast, change the size of the pointer offset to fix
> these warnings.
> 
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
> ---
> v2:
> - change the macro of MPIC_MSGR_MER_OFFSET to avoid type cast and
>   simplify the fix
> ---
>  arch/powerpc/sysdev/mpic_msgr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
> index a439e33eae06..d75064fb7d12 100644
> --- a/arch/powerpc/sysdev/mpic_msgr.c
> +++ b/arch/powerpc/sysdev/mpic_msgr.c
> @@ -20,7 +20,7 @@
>  
>  #define MPIC_MSGR_REGISTERS_PER_BLOCK	4
>  #define MPIC_MSGR_STRIDE		0x10
> -#define MPIC_MSGR_MER_OFFSET		0x100
> +#define MPIC_MSGR_MER_OFFSET		(0x100 / sizeof(u32))
>  #define MSGR_INUSE			0
>  #define MSGR_FREE			1
>  
> @@ -234,7 +234,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
>  
>  		reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i;
>  		msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE;
> -		msgr->mer = (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET);
> +		msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;
>  		msgr->in_use = MSGR_FREE;
>  		msgr->num = i;
>  		raw_spin_lock_init(&msgr->lock);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings
  2022-10-19  6:34 [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings ruanjinjie
  2022-10-29  1:01 ` Ruan Jinjie
@ 2022-11-02  8:34 ` Christophe Leroy
  2022-11-30  9:24 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Christophe Leroy @ 2022-11-02  8:34 UTC (permalink / raw)
  To: ruanjinjie, mpe, npiggin, joel, Julia.Lawall, linuxppc-dev, linux-kernel



Le 19/10/2022 à 08:34, ruanjinjie a écrit :
> When build Linux kernel, encounter the following warnings:
> 
> ./arch/powerpc/sysdev/mpic_msgr.c:230:38: warning: cast removes address space '__iomem' of expression
> ./arch/powerpc/sysdev/mpic_msgr.c:230:27: warning: incorrect type in assignment (different address spaces)
> 
> The data type of msgr->mer and msgr->base are 'u32 __iomem *', but
> converted to 'u32 *' and 'u8 *' directly and cause above warnings, now
> instead of using a type cast, change the size of the pointer offset to fix
> these warnings.
> 
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
> v2:
> - change the macro of MPIC_MSGR_MER_OFFSET to avoid type cast and
>    simplify the fix
> ---
>   arch/powerpc/sysdev/mpic_msgr.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
> index a439e33eae06..d75064fb7d12 100644
> --- a/arch/powerpc/sysdev/mpic_msgr.c
> +++ b/arch/powerpc/sysdev/mpic_msgr.c
> @@ -20,7 +20,7 @@
>   
>   #define MPIC_MSGR_REGISTERS_PER_BLOCK	4
>   #define MPIC_MSGR_STRIDE		0x10
> -#define MPIC_MSGR_MER_OFFSET		0x100
> +#define MPIC_MSGR_MER_OFFSET		(0x100 / sizeof(u32))
>   #define MSGR_INUSE			0
>   #define MSGR_FREE			1
>   
> @@ -234,7 +234,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
>   
>   		reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i;
>   		msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE;
> -		msgr->mer = (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET);
> +		msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;
>   		msgr->in_use = MSGR_FREE;
>   		msgr->num = i;
>   		raw_spin_lock_init(&msgr->lock);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings
  2022-10-19  6:34 [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings ruanjinjie
  2022-10-29  1:01 ` Ruan Jinjie
  2022-11-02  8:34 ` Christophe Leroy
@ 2022-11-30  9:24 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-11-30  9:24 UTC (permalink / raw)
  To: joel, npiggin, linux-kernel, christophe.leroy, mpe, ruanjinjie,
	Julia.Lawall, linuxppc-dev

On Wed, 19 Oct 2022 14:34:14 +0800, ruanjinjie wrote:
> When build Linux kernel, encounter the following warnings:
> 
> ./arch/powerpc/sysdev/mpic_msgr.c:230:38: warning: cast removes address space '__iomem' of expression
> ./arch/powerpc/sysdev/mpic_msgr.c:230:27: warning: incorrect type in assignment (different address spaces)
> 
> The data type of msgr->mer and msgr->base are 'u32 __iomem *', but
> converted to 'u32 *' and 'u8 *' directly and cause above warnings, now
> instead of using a type cast, change the size of the pointer offset to fix
> these warnings.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/mpic_msgr: fix cast removes address space of expression warnings
      https://git.kernel.org/powerpc/c/16a3f41ff3322830683d3ccc14d77736829c61bf

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-30  9:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19  6:34 [PATCH -next v2] powerpc/mpic_msgr: fix cast removes address space of expression warnings ruanjinjie
2022-10-29  1:01 ` Ruan Jinjie
2022-11-02  8:34 ` Christophe Leroy
2022-11-30  9:24 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®