[PATCH] x86/irq: fix [-Wvisibility] warnings

Tudor Ambarus posted 1 patch 1 year, 11 months ago
arch/x86/include/asm/irq.h | 3 +++
1 file changed, 3 insertions(+)
[PATCH] x86/irq: fix [-Wvisibility] warnings
Posted by Tudor Ambarus 1 year, 11 months ago
Sorting include entries in alphabetical order for
drivers/tty/serial/samsung_tty.c revealed the following warnings:

   In file included from drivers/tty/serial/samsung_tty.c:24:
>> arch/x86/include/asm/irq.h:39:56: warning: declaration of 'struct pt_regs' will not be visible outside of this function [-Wvisibility]
      39 | extern void __handle_irq(struct irq_desc *desc, struct pt_regs *regs);
         |                                                        ^
>> arch/x86/include/asm/irq.h:44:50: warning: declaration of 'struct cpumask' will not be visible outside of this function [-Wvisibility]
      44 | void arch_trigger_cpumask_backtrace(const struct cpumask *mask,
         |                                                  ^
   2 warnings generated.

Fix them by including <linux/cpumask.h> and by adding a forward
declaration for ``struct pt_regs``.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401090827.6Qt43Hqk-lkp@intel.com/
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 arch/x86/include/asm/irq.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index 836c170d3087..4b689cec473e 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -10,6 +10,7 @@
 
 #include <asm/apicdef.h>
 #include <asm/irq_vectors.h>
+#include <linux/cpumask.h>
 
 /*
  * The irq entry code is in the noinstr section and the start/end of
@@ -36,6 +37,8 @@ extern void kvm_set_posted_intr_wakeup_handler(void (*handler)(void));
 extern void (*x86_platform_ipi_callback)(void);
 extern void native_init_IRQ(void);
 
+struct pt_regs;
+
 extern void __handle_irq(struct irq_desc *desc, struct pt_regs *regs);
 
 extern void init_ISA_irqs(void);
-- 
2.43.0.472.g3155946c3a-goog
Re: [PATCH] x86/irq: fix [-Wvisibility] warnings
Posted by Thomas Gleixner 1 year, 11 months ago
On Tue, Jan 09 2024 at 14:10, Tudor Ambarus wrote:
>  
>  #include <asm/apicdef.h>
>  #include <asm/irq_vectors.h>
> +#include <linux/cpumask.h>

Why does this need the include?

>       44 | void arch_trigger_cpumask_backtrace(const struct cpumask *mask,

That's a pointer so a simple forward declaration should work, no?

Thanks,

        tglx