linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Nazarewicz <mina86@mina86.com>,
	Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
	Borislav Petkov <bp@suse.de>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Johannes Berg <johannes.berg@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Alexander Potapenko <glider@google.com>,
	Ian Abbott <abbotti@mev.co.uk>
Subject: [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h
Date: Wed, 24 May 2017 17:06:27 +0100	[thread overview]
Message-ID: <20170524160627.14322-1-abbotti@mev.co.uk> (raw)
In-Reply-To: <20170524132107.6919-2-abbotti@mev.co.uk>

If "include/linux/kernel.h" includes <linux/bug.h>, a circular
dependency is introduced when "include/asm-generic/bug.h" includes
<linux/kernel.h>.  This results in build breakage when something
includes <asm/bug.h> before <linux/kernel.h> for architectures that
select `CONFIG_GENERIC_BUG` because `struct bug_entry` is not fully
declared (not declared at all in fact) before its members are accessed
by `is_warning_bug()`.

To avoid this problem, remove the inclusion of <linux/kernel.h> from
"include/asm-generic/bug.h", but include <linux/types.h> from
"include/linux/bug.h" because it needs the `bool` type.

A consequence of this change is that since most bug-related,
function-link macros (`BUG()`, `WARN()` etc.) make use of facilities
provided by <linux/kernel.h>, something else needs to include that
before those macros are called.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
v2: Fix typo in patch subject line.
---
 include/asm-generic/bug.h | 1 -
 include/linux/bug.h       | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 87191357d303..074a66de47f6 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -12,7 +12,6 @@
 #endif
 
 #ifndef __ASSEMBLY__
-#include <linux/kernel.h>
 
 #ifdef CONFIG_BUG
 
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 687b557fc5eb..68692b775343 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -3,6 +3,7 @@
 
 #include <asm/bug.h>
 #include <linux/compiler.h>
+#include <linux/types.h>
 
 enum bug_trap_type {
 	BUG_TRAP_TYPE_NONE = 0,
-- 
2.11.0

  parent reply	other threads:[~2017-05-24 16:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 13:21 [PATCH 0/1] bug: fix problem including <linux.bug.h> from linux/kernel.h Ian Abbott
2017-05-24 13:21 ` [PATCH 1/1] " Ian Abbott
2017-05-24 13:21   ` Ian Abbott
2017-05-24 13:37   ` Rasmus Villemoes
2017-05-24 15:55     ` Ian Abbott
2017-05-24 16:06   ` Ian Abbott [this message]
2017-05-24 23:11     ` [PATCH v2] bug: fix problem including <linux/bug.h> " Ian Abbott
2017-05-24 23:26     ` kbuild test robot
2017-05-24 23:26       ` kbuild test robot
2017-05-24 23:53     ` kbuild test robot
2017-05-24 23:53       ` kbuild test robot
2017-05-25  2:25   ` [PATCH 1/1] bug: fix problem including <linux.bug.h> " kbuild test robot
2017-05-25  2:25     ` kbuild test robot
2017-05-25  2:47   ` kbuild test robot
2017-05-25  2:47     ` kbuild test robot

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=20170524160627.14322-1-abbotti@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bp@suse.de \
    --cc=glider@google.com \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mina86@mina86.com \
    --cc=peterz@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).