2024-01-09 14:10:59

by Tudor Ambarus

[permalink] [raw]
Subject: [PATCH] x86/irq: fix [-Wvisibility] warnings

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 <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Tudor Ambarus <[email protected]>
---
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



2024-01-25 18:50:32

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH] x86/irq: fix [-Wvisibility] warnings

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