[PATCH v2] bug: make __warn unconditionally defined

From: Stephen Zhang
Date: Mon Apr 25 2022 - 23:22:45 EST


From: Shida Zhang <zhangshida@xxxxxxxxxx>

__warn() was defined when CONFIG_BUG gets defined originally, but
it was used unconditonally by traps.c. So the idea is to have the
__warn unconditional.

Signed-off-by: Shida Zhang <zhangshida@xxxxxxxxxx>
---
Changelog in v1 -> v2:
- To have the __warn() unconditional instead.

include/asm-generic/bug.h | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index edb0e2a602a8..ba1f860af38b 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -21,6 +21,12 @@
#include <linux/panic.h>
#include <linux/printk.h>

+struct warn_args;
+struct pt_regs;
+
+void __warn(const char *file, int line, void *caller, unsigned taint,
+ struct pt_regs *regs, struct warn_args *args);
+
#ifdef CONFIG_BUG

#ifdef CONFIG_GENERIC_BUG
@@ -110,11 +116,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
#endif

/* used internally by panic.c */
-struct warn_args;
-struct pt_regs;
-
-void __warn(const char *file, int line, void *caller, unsigned taint,
- struct pt_regs *regs, struct warn_args *args);

#ifndef WARN_ON
#define WARN_ON(condition) ({ \
--
2.30.2