Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: prevent potential circular header dependencies in asm/bug.h

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>

authored by

Ard Biesheuvel and committed by
Catalin Marinas
03336b1d 369bc9ab

+3 -2
+1 -1
arch/arm64/include/asm/bug.h
··· 18 18 #ifndef _ARCH_ARM64_ASM_BUG_H 19 19 #define _ARCH_ARM64_ASM_BUG_H 20 20 21 - #include <asm/debug-monitors.h> 21 + #define BUG_BRK_IMM 0x800 22 22 23 23 #ifdef CONFIG_GENERIC_BUG 24 24 #define HAVE_ARCH_BUG
+1 -1
arch/arm64/include/asm/debug-monitors.h
··· 20 20 21 21 #include <linux/errno.h> 22 22 #include <linux/types.h> 23 + #include <asm/bug.h> 23 24 #include <asm/esr.h> 24 25 #include <asm/insn.h> 25 26 #include <asm/ptrace.h> ··· 58 57 #define FAULT_BRK_IMM 0x100 59 58 #define KGDB_DYN_DBG_BRK_IMM 0x400 60 59 #define KGDB_COMPILED_DBG_BRK_IMM 0x401 61 - #define BUG_BRK_IMM 0x800 62 60 63 61 /* 64 62 * BRK instruction encoding
+1
arch/arm64/kvm/hyp/debug-sr.c
··· 18 18 #include <linux/compiler.h> 19 19 #include <linux/kvm_host.h> 20 20 21 + #include <asm/debug-monitors.h> 21 22 #include <asm/kvm_asm.h> 22 23 #include <asm/kvm_mmu.h> 23 24