diff mbox

powerpc: Quick fix upstream main line build error on PowerPC

Message ID 1444359309-40375-1-git-send-email-dongsheng.wang@freescale.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Dongsheng Wang Oct. 9, 2015, 2:55 a.m. UTC
From: Wang Dongsheng <dongsheng.wang@freescale.com>

This issue caused on 'commit 990486c8af04 ("strscpy: zero any trailing
garbage bytes in the destination")'.

zero_bytemask is not implemented on PowerPC. So copy the zero_bytemask
of BIG_ENDIAN implementation from include/asm-generic/word-at-a-time.h
to arch/powerpc/include/asm/word-at-a-time.h.

Build message:
lib/string.c: In function 'strscpy':
lib/string.c:209:4: error: implicit declaration of function
	'zero_bytemask' [-Werror=implicit-function-declaration]
	*(unsigned long *)(dest+res) = c & zero_bytemask(data);
cc1: some warnings being treated as errors
make[1]: *** [lib/string.o] Error 1
make[1]: *** Waiting for unfinished jobs....

Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>

Comments

Chris Metcalf Oct. 9, 2015, 2:24 p.m. UTC | #1
On 10/08/2015 10:55 PM, Dongsheng Wang wrote:
> From: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> This issue caused on 'commit 990486c8af04 ("strscpy: zero any trailing
> garbage bytes in the destination")'.
>
> zero_bytemask is not implemented on PowerPC. So copy the zero_bytemask
> of BIG_ENDIAN implementation from include/asm-generic/word-at-a-time.h
> to arch/powerpc/include/asm/word-at-a-time.h.

Thanks; a fix is already queued for Linus.
Aneesh Kumar K.V Oct. 10, 2015, 6:19 a.m. UTC | #2
Dongsheng Wang <dongsheng.wang@freescale.com> writes:

> From: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> This issue caused on 'commit 990486c8af04 ("strscpy: zero any trailing
> garbage bytes in the destination")'.
>
> zero_bytemask is not implemented on PowerPC. So copy the zero_bytemask
> of BIG_ENDIAN implementation from include/asm-generic/word-at-a-time.h
> to arch/powerpc/include/asm/word-at-a-time.h.
>
> Build message:
> lib/string.c: In function 'strscpy':
> lib/string.c:209:4: error: implicit declaration of function
> 	'zero_bytemask' [-Werror=implicit-function-declaration]
> 	*(unsigned long *)(dest+res) = c & zero_bytemask(data);
> cc1: some warnings being treated as errors
> make[1]: *** [lib/string.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
>
> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
> index 5b3a903..d891456 100644
> --- a/arch/powerpc/include/asm/word-at-a-time.h
> +++ b/arch/powerpc/include/asm/word-at-a-time.h
> @@ -40,6 +40,10 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct
>  	return (val + c->high_bits) & ~rhs;
>  }
>  
> +#ifndef zero_bytemask
> +#define zero_bytemask(mask) (~1ul << __fls(mask))
> +#endif
> +
>  #else


Why #ifndef zero_bytemask ?. What will override zero_bytemask defined in
arch headers. We generally do it such that generic code does #ifndef, but arch
headers doesn't need to do this.

-aneesh
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
index 5b3a903..d891456 100644
--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -40,6 +40,10 @@  static inline bool has_zero(unsigned long val, unsigned long *data, const struct
 	return (val + c->high_bits) & ~rhs;
 }
 
+#ifndef zero_bytemask
+#define zero_bytemask(mask) (~1ul << __fls(mask))
+#endif
+
 #else
 
 #ifdef CONFIG_64BIT