[PATCH v2 2/2] include: warn for inconsistent endian config definition

2017-06-09 Thread Babu Moger
We have seen some generic code use config parameter CONFIG_CPU_BIG_ENDIAN to decide the endianness. Here are the few examples. include/asm-generic/qrwlock.h drivers/of/base.c drivers/of/fdt.c drivers/tty/serial/earlycon.c drivers/tty/serial/serial_core.c Display warning if CPU_BIG_ENDIAN is not

[PATCH v2 0/2] Define CPU_BIG_ENDIAN or warn for inconsistencies

2017-06-09 Thread Babu Moger
Found this problem while enabling queued rwlock on SPARC. The parameter CONFIG_CPU_BIG_ENDIAN is used to clear the specific byte in qrwlock structure. Without this parameter, we clear the wrong byte. Here is the code in include/asm-generic/qrwlock.h static inline u8 *__qrwlock_write_byte(struct

Re: [PATCH 1/2] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs

2017-06-09 Thread David Miller
From: Babu Moger Date: Thu, 8 Jun 2017 15:17:22 -0700 > While working on enabling queued rwlock on SPARC, found > this following code in include/asm-generic/qrwlock.h > which uses CONFIG_CPU_BIG_ENDIAN to clear a byte. > > static inline u8 *__qrwlock_write_byte(struct

Re: [PATCH 1/2] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs

2017-06-09 Thread Babu Moger
On 6/9/2017 2:03 AM, Geert Uytterhoeven wrote: On Fri, Jun 9, 2017 at 12:17 AM, Babu Moger wrote: While working on enabling queued rwlock on SPARC, found this following code in include/asm-generic/qrwlock.h which uses CONFIG_CPU_BIG_ENDIAN to clear a byte. static

Re: [PATCH 2/2] include: warn for inconsistent endian config definition

2017-06-09 Thread Babu Moger
On 6/9/2017 9:11 AM, Geert Uytterhoeven wrote: Hi Babu, On Fri, Jun 9, 2017 at 3:55 PM, Babu Moger wrote: On 6/9/2017 2:16 AM, Geert Uytterhoeven wrote: On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven wrote: Here is the original discussion

Re: [PATCH 2/2] include: warn for inconsistent endian config definition

2017-06-09 Thread Geert Uytterhoeven
Hi Babu, On Fri, Jun 9, 2017 at 3:55 PM, Babu Moger wrote: > On 6/9/2017 2:16 AM, Geert Uytterhoeven wrote: >> On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven >> wrote: Here is the original discussion

Re: [PATCH 2/2] include: warn for inconsistent endian config definition

2017-06-09 Thread Babu Moger
Geert, On 6/9/2017 2:16 AM, Geert Uytterhoeven wrote: Hi Babu, On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven wrote: Here is the original discussion http://www.spinics.net/lists/devicetree/msg178101.html Signed-off-by: Babu Moger

Re: [PATCH 2/2] include: warn for inconsistent endian config definition

2017-06-09 Thread Geert Uytterhoeven
Hi Babu, On Fri, Jun 9, 2017 at 9:05 AM, Geert Uytterhoeven wrote: > >> Here is the original discussion >> http://www.spinics.net/lists/devicetree/msg178101.html >> >> Signed-off-by: Babu Moger >> Suggested-by: Arnd Bergmann > > Hmm,

Re: [PATCH 2/2] include: warn for inconsistent endian config definition

2017-06-09 Thread Geert Uytterhoeven
On Fri, Jun 9, 2017 at 12:17 AM, Babu Moger wrote: > Display warning if CPU_BIG_ENDIAN is not defined on big endian > architecture and also warn if it defined on little endian architectures. > > We have seen some generic code(for example code include/asm-generic/qrwlock.h)

Re: [PATCH 1/2] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs

2017-06-09 Thread Geert Uytterhoeven
On Fri, Jun 9, 2017 at 12:17 AM, Babu Moger wrote: > While working on enabling queued rwlock on SPARC, found > this following code in include/asm-generic/qrwlock.h > which uses CONFIG_CPU_BIG_ENDIAN to clear a byte. > > static inline u8 *__qrwlock_write_byte(struct qrwlock