All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/align: Use #ifdef __BIG_ENDIAN__ #else for REG_BYTE
@ 2016-06-16 12:33 Michael Ellerman
  2016-06-16 13:05 ` Arnd Bergmann
  2016-06-21  0:40 ` Michael Ellerman
  0 siblings, 2 replies; 9+ messages in thread
From: Michael Ellerman @ 2016-06-16 12:33 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: dja

From: Daniel Axtens <dja@axtens.net>

Sparse complains that it doesn't know what REG_BYTE is:

  arch/powerpc/kernel/align.c:313:29: error: undefined identifier 'REG_BYTE'

REG_BYTE is defined differently based on whether we're compiling for
LE, BE32 or BE64. Sparse apparently doesn't provide __BIG_ENDIAN__ or
__LITTLE_ENDIAN__, which means we get no definition.

Rather than check for __BIG_ENDIAN__ and then separately for
__LITTLE_ENDIAN__, just switch the #ifdef to check for __BIG_ENDIAN__
and then #else we define the little endian version. Technically that's
dicey because PDP_ENDIAN is also a possibility, but we already do it in
a lot of places so one more hardly matters.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/align.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 8e7cb8e2b21a..d7ad66bc5bdf 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -228,9 +228,7 @@ static int emulate_dcbz(struct pt_regs *regs, unsigned char __user *addr)
 #else
 #define REG_BYTE(rp, i)		*((u8 *)(rp) + (i))
 #endif
-#endif
-
-#ifdef __LITTLE_ENDIAN__
+#else
 #define REG_BYTE(rp, i)		(*(((u8 *)((rp) + ((i)>>2)) + ((i)&3))))
 #endif
 
-- 
2.5.0

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

end of thread, other threads:[~2016-06-21  9:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-16 12:33 [PATCH] powerpc/align: Use #ifdef __BIG_ENDIAN__ #else for REG_BYTE Michael Ellerman
2016-06-16 13:05 ` Arnd Bergmann
2016-06-17  3:35   ` Daniel Axtens
2016-06-17 10:46     ` Arnd Bergmann
2016-06-21  0:51       ` Michael Ellerman
2016-06-21  9:04         ` Arnd Bergmann
2016-06-21  1:11       ` Daniel Axtens
2016-06-17  5:35   ` Michael Ellerman
2016-06-21  0:40 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.