Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649612

[PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Ian Abbott <abbotti@mev.co.uk>
Newsgroups linux.kernel
Subject [PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h
Date Wed, 24 May 2017 15:30:01 +0200
Message-ID <tKEwp-2RX-1@gated-at.bofh.it> (permalink)
References <tKEwp-2RX-3@gated-at.bofh.it>
X-Original-To linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
X-Auth-ID abbotti@mev.co.uk
X-Sender-ID abbotti@mev.co.uk
X-Mailer git-send-email 2.11.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 53
Organization linux.* mail to news gateway
X-Original-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>
X-Original-Date Wed, 24 May 2017 14:21:07 +0100
X-Original-Message-ID <20170524132107.6919-2-abbotti@mev.co.uk>
X-Original-References <20170524132107.6919-1-abbotti@mev.co.uk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1649612

Show key headers only | View raw


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>
---
 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

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-24 15:30 +0200
  Re: [PATCH 1/1] bug: fix problem including <linux.bug.h> from linux/kernel.h Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2017-05-24 15:40 +0200
    Re: [PATCH 1/1] bug: fix problem including <linux.bug.h> from  linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-24 18:10 +0200
  [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-24 18:10 +0200
    Re: [PATCH v2] bug: fix problem including <linux/bug.h> from  linux/kernel.h Ian Abbott <abbotti@mev.co.uk> - 2017-05-25 01:20 +0200

csiph-web