linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings
@ 2022-09-01  8:54 ruanjinjie
  2022-09-30  1:34 ` Ruan Jinjie
  2022-09-30  6:09 ` Christophe Leroy
  0 siblings, 2 replies; 5+ messages in thread
From: ruanjinjie @ 2022-09-01  8:54 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
recover their data types to fix these warnings.

Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
---
 arch/powerpc/sysdev/mpic_msgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index 698fefaaa6dd..cbb0d24f15ba 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -227,7 +227,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 = (u32 __iomem *)((u8 __iomem *)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 related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings
  2022-09-01  8:54 [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings ruanjinjie
@ 2022-09-30  1:34 ` Ruan Jinjie
  2022-09-30  6:09 ` Christophe Leroy
  1 sibling, 0 replies; 5+ messages in thread
From: Ruan Jinjie @ 2022-09-30  1:34 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, joel, Julia.Lawall, linuxppc-dev,
	linux-kernel

Ping.

On 2022/9/1 16:54, 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
> recover their data types to fix these warnings.
> 
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
> ---
>  arch/powerpc/sysdev/mpic_msgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
> index 698fefaaa6dd..cbb0d24f15ba 100644
> --- a/arch/powerpc/sysdev/mpic_msgr.c
> +++ b/arch/powerpc/sysdev/mpic_msgr.c
> @@ -227,7 +227,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 = (u32 __iomem *)((u8 __iomem *)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] 5+ messages in thread

* Re: [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings
  2022-09-01  8:54 [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings ruanjinjie
  2022-09-30  1:34 ` Ruan Jinjie
@ 2022-09-30  6:09 ` Christophe Leroy
  2022-09-30  6:37   ` Ruan Jinjie
  2022-09-30  7:25   ` Michael Ellerman
  1 sibling, 2 replies; 5+ messages in thread
From: Christophe Leroy @ 2022-09-30  6:09 UTC (permalink / raw)
  To: ruanjinjie, mpe, npiggin, joel, Julia.Lawall, linuxppc-dev, linux-kernel



Le 01/09/2022 à 10:54, ruanjinjie a écrit :
> [Vous ne recevez pas souvent de courriers de ruanjinjie@huawei.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> 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
> recover their data types to fix these warnings.

I think the best would be to change MPIC_MSGR_MER_OFFSET to 0x40 and 
then drop the casts completely:

	msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;

> 
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
> ---
>   arch/powerpc/sysdev/mpic_msgr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
> index 698fefaaa6dd..cbb0d24f15ba 100644
> --- a/arch/powerpc/sysdev/mpic_msgr.c
> +++ b/arch/powerpc/sysdev/mpic_msgr.c
> @@ -227,7 +227,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 = (u32 __iomem *)((u8 __iomem *)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] 5+ messages in thread

* Re: [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings
  2022-09-30  6:09 ` Christophe Leroy
@ 2022-09-30  6:37   ` Ruan Jinjie
  2022-09-30  7:25   ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Ruan Jinjie @ 2022-09-30  6:37 UTC (permalink / raw)
  To: Christophe Leroy, mpe, npiggin, joel, Julia.Lawall, linuxppc-dev,
	linux-kernel



On 2022/9/30 14:09, Christophe Leroy wrote:
> 
> 
> Le 01/09/2022 à 10:54, ruanjinjie a écrit :
>> [Vous ne recevez pas souvent de courriers de ruanjinjie@huawei.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>>
>> 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
>> recover their data types to fix these warnings.
> 
> I think the best would be to change MPIC_MSGR_MER_OFFSET to 0x40 and 
> then drop the casts completely:
> 
> 	msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;
> 
I think this is good to solve the warning.

>>
>> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
>> ---
>>   arch/powerpc/sysdev/mpic_msgr.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
>> index 698fefaaa6dd..cbb0d24f15ba 100644
>> --- a/arch/powerpc/sysdev/mpic_msgr.c
>> +++ b/arch/powerpc/sysdev/mpic_msgr.c
>> @@ -227,7 +227,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 = (u32 __iomem *)((u8 __iomem *)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] 5+ messages in thread

* Re: [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings
  2022-09-30  6:09 ` Christophe Leroy
  2022-09-30  6:37   ` Ruan Jinjie
@ 2022-09-30  7:25   ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2022-09-30  7:25 UTC (permalink / raw)
  To: Christophe Leroy, ruanjinjie, npiggin, joel, Julia.Lawall,
	linuxppc-dev, linux-kernel

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 01/09/2022 à 10:54, ruanjinjie a écrit :
>> [Vous ne recevez pas souvent de courriers de ruanjinjie@huawei.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>> 
>> 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
>> recover their data types to fix these warnings.
>
> I think the best would be to change MPIC_MSGR_MER_OFFSET to 0x40 and 
> then drop the casts completely:
>
> 	msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET;

Or:

#define MPIC_MSGR_MER_OFFSET    (0x100 / sizeof(u32))

To document that it's 0x100 bytes, but the the offset is in units of u32.

cheers

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

end of thread, other threads:[~2022-09-30  7:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01  8:54 [PATCH -next] powerpc/mpic_msgr: fix cast removes address space of expression warnings ruanjinjie
2022-09-30  1:34 ` Ruan Jinjie
2022-09-30  6:09 ` Christophe Leroy
2022-09-30  6:37   ` Ruan Jinjie
2022-09-30  7:25   ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).