arm64: prevent potential circular header dependencies in asm/bug.h
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 16 Feb 2016 12:52:34 +0000 (13:52 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 18 Feb 2016 18:16:11 +0000 (18:16 +0000)
Currently, using BUG_ON() in header files is cumbersome, due to the fact
that asm/bug.h transitively includes a lot of other header files, resulting
in the actual BUG_ON() invocation appearing before its definition in the
preprocessor input. So let's reverse the #include dependency between
asm/bug.h and asm/debug-monitors.h, by moving the definition of BUG_BRK_IMM
from the latter to the former. Also fix up one user of asm/debug-monitors.h
which relied on a transitive include.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/bug.h
arch/arm64/include/asm/debug-monitors.h
arch/arm64/kvm/hyp/debug-sr.c

index 4a748ce9ba1a71241c8f13834e488cef9753dc38..679d49221998a7fa99d0ba3f135ee29b654972d3 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef _ARCH_ARM64_ASM_BUG_H
 #define _ARCH_ARM64_ASM_BUG_H
 
-#include <asm/debug-monitors.h>
+#define BUG_BRK_IMM                    0x800
 
 #ifdef CONFIG_GENERIC_BUG
 #define HAVE_ARCH_BUG
index 279c85b5ec091eafaa37fbb10d4ff59e2092a605..e893a1fca9c265d393bfa041ba592734c67fa83c 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/errno.h>
 #include <linux/types.h>
+#include <asm/bug.h>
 #include <asm/esr.h>
 #include <asm/insn.h>
 #include <asm/ptrace.h>
@@ -57,7 +58,6 @@
 #define FAULT_BRK_IMM                  0x100
 #define KGDB_DYN_DBG_BRK_IMM           0x400
 #define KGDB_COMPILED_DBG_BRK_IMM      0x401
-#define BUG_BRK_IMM                    0x800
 
 /*
  * BRK instruction encoding
index c9c1e97501a90df6449acf51eafdea87f34f92c1..2f8bca8af295b9029ba5780307d2a680495d08fb 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/compiler.h>
 #include <linux/kvm_host.h>
 
+#include <asm/debug-monitors.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmu.h>