Skip to content

Commit

Permalink
arm64: prevent potential circular header dependencies in asm/bug.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ard Biesheuvel authored and Catalin Marinas committed Feb 18, 2016
1 parent 369bc9a commit 03336b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/debug-monitors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/kvm/hyp/debug-sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down

0 comments on commit 03336b1

Please sign in to comment.