public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Babu Moger <babu.moger@oracle.com>
To: ysato@users.sourceforge.jp, geert@linux-m68k.org,
	jonas@southpole.se, stefan.kristiansson@saunalahti.fi,
	shorne@gmail.com, jejb@parisc-linux.org, deller@gmx.de,
	davem@davemloft.net, viro@zeniv.linux.org.uk
Cc: mpe@ellerman.id.au, peterz@infradead.org, mingo@redhat.com,
	jcmvbkbc@gmail.com, linux-kernel@vger.kernel.org,
	uclinux-h8-devel@lists.sourceforge.jp,
	linux-m68k@vger.kernel.org, openrisc@lists.librecores.org,
	linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org
Subject: [PATCH 2/2] include: warn for inconsistent endian config definition
Date: Thu,  8 Jun 2017 15:17:23 -0700	[thread overview]
Message-ID: <1496960243-196898-3-git-send-email-babu.moger@oracle.com> (raw)
In-Reply-To: <1496960243-196898-1-git-send-email-babu.moger@oracle.com>

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)
uses CONFIG_CPU_BIG_ENDIAN to decide the endianess.

Here is the original discussion
http://www.spinics.net/lists/devicetree/msg178101.html

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
---
 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

  parent reply	other threads:[~2017-06-08 22:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 22:17 [PATCH 0/2] Define CPU_BIG_ENDIAN or warn for inconsistencies Babu Moger
2017-06-08 22:17 ` [PATCH 1/2] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Babu Moger
2017-06-09  7:03   ` Geert Uytterhoeven
2017-06-09 15:55     ` Babu Moger
2017-06-09 16:40   ` David Miller
2017-06-08 22:17 ` Babu Moger [this message]
2017-06-09  7:05   ` [PATCH 2/2] include: warn for inconsistent endian config definition Geert Uytterhoeven
2017-06-09  7:16     ` Geert Uytterhoeven
2017-06-09 13:55       ` Babu Moger
2017-06-09 14:11         ` Geert Uytterhoeven
2017-06-09 14:39           ` Babu Moger
2017-06-10 14:06   ` kbuild test robot
2017-06-12 20:30     ` Babu Moger
2017-06-12 20:51       ` Arnd Bergmann
2017-06-12 20:58         ` Max Filippov
2017-06-12 21:31           ` Babu Moger
2017-06-12 21:24         ` Babu Moger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496960243-196898-3-git-send-email-babu.moger@oracle.com \
    --to=babu.moger@oracle.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=jejb@parisc-linux.org \
    --cc=jonas@southpole.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=openrisc@lists.librecores.org \
    --cc=peterz@infradead.org \
    --cc=shorne@gmail.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=stefan.kristiansson@saunalahti.fi \
    --cc=uclinux-h8-devel@lists.sourceforge.jp \
    --cc=viro@zeniv.linux.org.uk \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox