Re: [PATCH] x86/traps: add CONFIG_BUG to the use of __warn()

From: Stephen Zhang
Date: Mon Apr 25 2022 - 21:24:13 EST


> As pointed out by Boris, __warn is actually uncondtionally defined in
> panic.c, the below seems to build.
>
> ---
> 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) ({ \

Thanks.I will make a new version based on this suggestion.