mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] hwmon: (gpio-fan) return IRQ_HANDLED from the shared alarm IRQ handler
@ 2026-09-14 10:41 Cong Nguyen
  2026-09-14 15:25 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Nguyen @ 2026-09-14 10:41 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Simon Guinot, linux-hwmon, linux-kernel

fan_alarm_irq_handler() always schedules alarm_work but returns IRQ_NONE,
so the kernel treats every alarm interrupt as unhandled. On a shared
line that risks the whole line being disabled as spurious.

v1 just fixed that, but it was still IRQF_SHARED, and always returning
IRQ_HANDLED there defeats spurious-interrupt detection for the line --
if the interrupt ever fires without a real event, nothing catches it,
and a fault could spin the CPU in the handler.

Sashiko flagged this in v1, and Guenter confirmed: this interrupt must
not be shared. So v2 drops IRQF_SHARED too.

Fixes: d6fe1360f42e ("hwmon: add generic GPIO fan driver")
Reported-by: Sashiko AI review <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/r/20260901160931.DD3811F00A3D@smtp.kernel.org
Assisted-by: Claude:claude-opus-4
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
Changes in v2:
- Also drop IRQF_SHARED (Guenter): always returning IRQ_HANDLED on a
  still-shared line defeats spurious-interrupt detection for it. v2
  is a full patch with both fixes, not a delta on top of v1.

 drivers/hwmon/gpio-fan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index 084828e1e281..0dbd07f5dc53 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -67,7 +67,7 @@ static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id)
 
 	schedule_work(&fan_data->alarm_work);
 
-	return IRQ_NONE;
+	return IRQ_HANDLED;
 }
 
 static ssize_t fan1_alarm_show(struct device *dev,
@@ -97,7 +97,7 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data)
 	INIT_WORK(&fan_data->alarm_work, fan_alarm_notify);
 	irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH);
 	return devm_request_irq(dev, alarm_irq, fan_alarm_irq_handler,
-				IRQF_SHARED, "GPIO fan alarm", fan_data);
+				0, "GPIO fan alarm", fan_data);
 }
 
 /*
-- 
2.25.1


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

* Re: [PATCH v2] hwmon: (gpio-fan) return IRQ_HANDLED from the shared alarm IRQ handler
  2026-09-14 10:41 [PATCH v2] hwmon: (gpio-fan) return IRQ_HANDLED from the shared alarm IRQ handler Cong Nguyen
@ 2026-09-14 15:25 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2026-09-14 15:25 UTC (permalink / raw)
  To: Cong Nguyen; +Cc: Simon Guinot, linux-hwmon, linux-kernel

On Mon, Sep 14, 2026 at 05:41:36PM +0700, Cong Nguyen wrote:
> fan_alarm_irq_handler() always schedules alarm_work but returns IRQ_NONE,
> so the kernel treats every alarm interrupt as unhandled. On a shared
> line that risks the whole line being disabled as spurious.
> 
> v1 just fixed that, but it was still IRQF_SHARED, and always returning
> IRQ_HANDLED there defeats spurious-interrupt detection for the line --
> if the interrupt ever fires without a real event, nothing catches it,
> and a fault could spin the CPU in the handler.
> 
> Sashiko flagged this in v1, and Guenter confirmed: this interrupt must
> not be shared. So v2 drops IRQF_SHARED too.
> 
> Fixes: d6fe1360f42e ("hwmon: add generic GPIO fan driver")
> Reported-by: Sashiko AI review <sashiko-bot@kernel.org>
> Link: https://lore.kernel.org/r/20260901160931.DD3811F00A3D@smtp.kernel.org
> Assisted-by: Claude:claude-opus-4
> Signed-off-by: Cong Nguyen <congnt264@gmail.com>

Applied.

Thanks,
Guenter

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

end of thread, other threads:[~2026-09-14 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 10:41 [PATCH v2] hwmon: (gpio-fan) return IRQ_HANDLED from the shared alarm IRQ handler Cong Nguyen
2026-09-14 15:25 ` Guenter Roeck

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

all inboxes | Powered by JetHome®