public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] linux/interrupt.h: allow "guard" notation to disable and reenable IRQ with valid IRQ check
@ 2026-01-21 23:23 Marek Vasut
  2026-01-21 23:23 ` [PATCH 2/2] Input: ili210x - convert to disable_valid_irq scoped guard Marek Vasut
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Marek Vasut @ 2026-01-21 23:23 UTC (permalink / raw)
  To: linux-input
  Cc: Marek Vasut, Peter Zijlstra (Intel), Cheng-Yang Chou,
	Dmitry Torokhov, Frank Li, Geert Uytterhoeven, Jinjie Ruan,
	Krzysztof Kozlowski, Marc Zyngier, Sebastian Andrzej Siewior,
	Thomas Gleixner, linux-kernel, linux-renesas-soc

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.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Cheng-Yang Chou <yphbchou0911@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Frank Li <Frank.Li@nxp.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-renesas-soc@vger.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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-02-12 18:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 23:23 [PATCH 1/2] linux/interrupt.h: allow "guard" notation to disable and reenable IRQ with valid IRQ check Marek Vasut
2026-01-21 23:23 ` [PATCH 2/2] Input: ili210x - convert to disable_valid_irq scoped guard Marek Vasut
2026-01-22 15:38 ` [PATCH 1/2] linux/interrupt.h: allow "guard" notation to disable and reenable IRQ with valid IRQ check Frank Li
2026-01-22 19:11   ` Marek Vasut
2026-01-22 16:22 ` Sebastian Andrzej Siewior
2026-01-22 16:31   ` Geert Uytterhoeven
2026-01-22 18:38     ` Dmitry Torokhov
2026-01-22 18:57     ` Sergey Shtylyov
2026-01-23 10:52   ` Thomas Gleixner
2026-01-25  5:30     ` Dmitry Torokhov
2026-01-27  9:14 ` Thomas Gleixner
2026-01-28 12:23   ` Marek Vasut
2026-01-28 13:49     ` Thomas Gleixner
2026-01-28 14:33       ` Marek Vasut
2026-02-12 18:44         ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox