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@xxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Michal Nazarewicz <mina86@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
---
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(-)