Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662716
| From | Babu Moger <babu.moger@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/2] include: warn for inconsistent endian config definition |
| Date | 2017-06-09 22:00 +0200 |
| Message-ID | <tQyeB-5Jz-11@gated-at.bofh.it> (permalink) |
| References | <tQy4W-5Fa-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 defined on big endian architecture and also warn if it defined on little endian architectures. Here is our original discussion https://lkml.org/lkml/2017/5/24/620 Signed-off-by: Babu Moger <babu.moger@oracle.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> --- include/linux/byteorder/big_endian.h | 4 ++++ include/linux/byteorder/little_endian.h | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index 3920414..ffd2159 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h @@ -3,5 +3,9 @@ #include <uapi/linux/byteorder/big_endian.h> +#ifndef CONFIG_CPU_BIG_ENDIAN +#warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN +#endif + #include <linux/byteorder/generic.h> #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index 0805737..ba910bb 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h @@ -3,5 +3,9 @@ #include <uapi/linux/byteorder/little_endian.h> +#ifdef CONFIG_CPU_BIG_ENDIAN +#warning inconsistent configuration, CONFIG_CPU_BIG_ENDIAN is set +#endif + #include <linux/byteorder/generic.h> #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ -- 1.7.1
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 0/2] Define CPU_BIG_ENDIAN or warn for inconsistencies Babu Moger <babu.moger@oracle.com> - 2017-06-09 21:50 +0200
[PATCH v2 1/2] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Babu Moger <babu.moger@oracle.com> - 2017-06-09 22:00 +0200
Re: [PATCH v2 1/2] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Stafford Horne <shorne@gmail.com> - 2017-06-10 10:30 +0200
[PATCH v2 2/2] include: warn for inconsistent endian config definition Babu Moger <babu.moger@oracle.com> - 2017-06-09 22:00 +0200
csiph-web