[PATCH 06/11] ARM: BUG: Move the __BUG() out of CONFIG_DEBUG_BUGVERBOSE

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Fri Oct 9 15:21:13 PDT 2026


Move the __BUG() macro out of the CONFIG_DEBUG_BUGVERBOSE block and
provide an empty _BUG_VERBOSE_LINE() macro for the
!CONFIG_DEBUG_BUGVERBOSE case.

This allows the removal of the other __BUG implementation (in the old
!CONFIG_DEBUG_BUGVERBOSE case). Remove BUG_INSTR which has no users now.

The side effect is that the entries in __bug_table are still added but
without FILE and LINE.

Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
---
 arch/arm/include/asm/bug.h | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 172e6a84541cb..c47b693aed8ae 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -13,11 +13,9 @@
  */
 #ifdef CONFIG_THUMB2_KERNEL
 #define BUG_INSTR_VALUE 0xde02
-#define BUG_INSTR(__value) __inst_thumb16(__value)
 #define BUG_ENCODING() .short ___asm_opcode_to_mem_thumb16(BUG_INSTR_VALUE)
 #else
 #define BUG_INSTR_VALUE 0xe7f001f2
-#define BUG_INSTR(__value) __inst_arm(__value)
 #define BUG_ENCODING() .long ___asm_opcode_to_mem_arm(BUG_INSTR_VALUE)
 #endif
 
@@ -26,7 +24,6 @@
 #define _BUG(file, line, value) __BUG(file, line, value)
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
-
 #define _BUG_VERBOSE_LINE(__file, __line)			\
 	.pushsection .rodata.str, "aMS", %progbits, 1;		\
 	2: .asciz  __file;					\
@@ -35,6 +32,10 @@
 	.word 2b;						\
 	.hword __line;						\
 
+#else
+#define _BUG_VERBOSE_LINE(__file, __line)
+#endif
+
 #ifdef CONFIG_GENERIC_BUG
 #define __BUG_ENTRY_GENERIC(__file, __line, __value)		\
 	.pushsection __bug_table,"aw";				\
@@ -65,15 +66,6 @@ do {								\
 	unreachable();						\
 } while (0)
 
-#else
-
-#define __BUG(__file, __line, __value)				\
-do {								\
-	asm volatile(BUG_INSTR(__value) "\n");			\
-	unreachable();						\
-} while (0)
-#endif  /* CONFIG_DEBUG_BUGVERBOSE */
-
 #define HAVE_ARCH_BUG
 
 #include <asm-generic/bug.h>

-- 
2.55.0




More information about the linux-arm-kernel mailing list