[PATCH 4/6] powerpc/kernel: Clean up some sparse warnings

Arnd Bergmann arnd at arndb.de
Mon Jul 4 17:50:23 AEST 2016


On Monday, July 4, 2016 5:09:40 PM CEST Daniel Axtens wrote:
> diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c
> index 2a2b4aeab80f..3f70b7dccee8 100644
> --- a/arch/powerpc/kernel/io.c
> +++ b/arch/powerpc/kernel/io.c
> @@ -37,7 +37,7 @@ void _insb(const volatile u8 __iomem *port, void *buf, long count)
>  		return;
>  	asm volatile("sync");
>  	do {
> -		tmp = *port;
> +		tmp = *(u8 __force *)port;
>  		eieio();
>  		*tbuf++ = tmp;
>  	} while (--count != 0);

Here the "volatile" is actually meaningful, you should keep it and
just add "__force" in addition.

> @@ -47,13 +47,13 @@ EXPORT_SYMBOL(_insb);
>  
>  void _outsb(volatile u8 __iomem *port, const void *buf, long count)
>  {
> -	const u8 *tbuf = buf;
> +	const u8 __force *tbuf = buf;
>  
>  	if (unlikely(count <= 0))
>  		return;
>  	asm volatile("sync");
>  	do {
> -		*port = *tbuf++;
> +		*(volatile u8 __force *)port = *tbuf++;
>  	} while (--count != 0);
>  	asm volatile("sync");
>  }

like you correctly do here.

> @@ -68,7 +68,7 @@ void _insw_ns(const volatile u16 __iomem *port, void *buf, long count)
>  		return;
>  	asm volatile("sync");
>  	do {
> -		tmp = *port;
> +		tmp = *(u16 __force *)port;
>  		eieio();
>  		*tbuf++ = tmp;
>  	} while (--count != 0);

+volatile

> @@ -99,7 +99,7 @@ void _insl_ns(const volatile u32 __iomem *port, void *buf, long count)
>  		return;
>  	asm volatile("sync");
>  	do {
> -		tmp = *port;
> +		tmp = *(u32 __force *)port;
>  		eieio();
>  		*tbuf++ = tmp;
>  	} while (--count != 0);

+volatile


	Arnd


More information about the Linuxppc-dev mailing list