Re: [PATCH v4 4/7] genirq: Export NMI APIs for qcom-wdt
From: Doug Anderson
Date: Mon Nov 23 2026 - 18:29:06 EST
Hi,
On Wed, Nov 11, 2026 at 7:16 PM Mayank Rungta <mrungta@xxxxxxxxxx> wrote:
>
> Currently, request_nmi(), free_nmi(), enable_nmi(), and disable_nmi() are
> restricted to built-in kernel code because they are not exported.
>
> Export these symbols with EXPORT_SYMBOL_FOR_MODULES() restricted to the
> qcom-wdt module so it can register and manage its pretimeout NMI when
> built as a loadable module.
>
> Signed-off-by: Mayank Rungta <mrungta@xxxxxxxxxx>
> ---
> kernel/irq/manage.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 073fd3595d2c..ace4d2796382 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -852,6 +852,7 @@ void disable_nmi(unsigned int irq)
> if (!__disable_irq_nosync(irq))
> __synchronize_nmi(desc, true);
> }
> +EXPORT_SYMBOL_FOR_MODULES(disable_nmi, "qcom-wdt");
>
> void __enable_irq(struct irq_desc *desc)
> {
> @@ -919,6 +920,7 @@ void enable_nmi(unsigned int irq)
> {
> enable_irq(irq);
> }
> +EXPORT_SYMBOL_FOR_MODULES(enable_nmi, "qcom-wdt");
>
> static int set_irq_wake_real(unsigned int irq, unsigned int on)
> {
> @@ -2189,6 +2191,7 @@ const void *free_nmi(unsigned int irq, void *dev_id)
>
> return __cleanup_nmi(irq, desc);
> }
> +EXPORT_SYMBOL_FOR_MODULES(free_nmi, "qcom-wdt");
>
> /**
> * request_threaded_irq - allocate an interrupt line
> @@ -2455,6 +2458,7 @@ int request_nmi(unsigned int irq, irq_handler_t handler,
>
> return retval;
> }
> +EXPORT_SYMBOL_FOR_MODULES(request_nmi, "qcom-wdt");
The patch is fine and I'd be fine with it landing. That being said,
looking at this patch with fresh eyes today, I think it can be
improved. :-)
I think we could make disable_nmi() and enable_nmi() simply
EXPORT_SYMBOL_GPL() and then only lock down the symbol for
request_nmi(). This means we don't need to update 3 separate places
every time we add a new watchdog driver allowed to use NMI. People
can't (properly) use the other two functions if they can't call
request_nmi() anyway, right?
-Doug