[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170524160627.14322-1-abbotti@mev.co.uk>
Date: Wed, 24 May 2017 17:06:27 +0100
From: Ian Abbott <abbotti@....co.uk>
To: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Cc: Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Nazarewicz <mina86@...a86.com>,
Hidehiro Kawai <hidehiro.kawai.ez@...achi.com>,
Borislav Petkov <bp@...e.de>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Johannes Berg <johannes.berg@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Alexander Potapenko <glider@...gle.com>,
Ian Abbott <abbotti@....co.uk>
Subject: [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h
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@....co.uk>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Michal Nazarewicz <mina86@...a86.com>
Cc: Peter Zijlstra <peterz@...radead.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
Powered by blists - more mailing lists