[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aXJEaTPIhDGFb11C@lizhi-Precision-Tower-5810>
Date: Thu, 22 Jan 2026 10:38:17 -0500
From: Frank Li <Frank.li@....com>
To: Marek Vasut <marek.vasut+renesas@...lbox.org>
Cc: linux-input@...r.kernel.org,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Cheng-Yang Chou <yphbchou0911@...il.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Jinjie Ruan <ruanjinjie@...wei.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>,
Marc Zyngier <maz@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Thomas Gleixner <tglx@...nel.org>, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH 1/2] linux/interrupt.h: allow "guard" notation to disable
and reenable IRQ with valid IRQ check
On Thu, Jan 22, 2026 at 12:23:47AM +0100, Marek Vasut wrote:
> Introduce disable_valid_irq scoped guard. This is an extension
> of disable_irq scoped guard, which disables and enables IRQs
> around a scope. The disable_valid_irq scoped guard does almost
> the same, except it handles the case where IRQ is not valid,
> in which case it does not do anything. This is meant to be used
> by for example touch controller drivers, which can do both IRQ
> driven and polling mode of operation, and this makes their code
> slighly simpler.
I think it'd better to give simple example here.
Frank
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@...lbox.org>
> ---
> Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>
> Cc: Cheng-Yang Chou <yphbchou0911@...il.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>
> Cc: Frank Li <Frank.Li@....com>
> Cc: Geert Uytterhoeven <geert+renesas@...der.be>
> Cc: Jinjie Ruan <ruanjinjie@...wei.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
> Cc: Marc Zyngier <maz@...nel.org>
> Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Cc: Thomas Gleixner <tglx@...nel.org>
> Cc: linux-input@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Cc: linux-renesas-soc@...r.kernel.org
> ---
> include/linux/interrupt.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
> index 00c01b0a43be1..becbeab4a7473 100644
> --- a/include/linux/interrupt.h
> +++ b/include/linux/interrupt.h
> @@ -242,6 +242,21 @@ extern void irq_wake_thread(unsigned int irq, void *dev_id);
> DEFINE_LOCK_GUARD_1(disable_irq, int,
> disable_irq(*_T->lock), enable_irq(*_T->lock))
>
> +static inline void disable_valid_irq(unsigned int irq)
> +{
> + if (irq > 0)
> + disable_irq(irq);
> +}
> +
> +static inline void enable_valid_irq(unsigned int irq)
> +{
> + if (irq > 0)
> + enable_irq(irq);
> +}
> +
> +DEFINE_LOCK_GUARD_1(disable_valid_irq, int,
> + disable_valid_irq(*_T->lock), enable_valid_irq(*_T->lock))
> +
> extern void disable_nmi_nosync(unsigned int irq);
> extern void disable_percpu_nmi(unsigned int irq);
> extern void enable_nmi(unsigned int irq);
> --
> 2.51.0
>
Powered by blists - more mailing lists