* [PATCH] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration
@ 2026-09-15 19:41 Vitaliy Sochnev
2026-09-18 9:24 ` Daniel Lezcano
0 siblings, 1 reply; 2+ messages in thread
From: Vitaliy Sochnev @ 2026-09-15 19:41 UTC (permalink / raw)
To: Daniel Lezcano, Rafael J. Wysocki
Cc: Zhang Rui, Lukasz Luba, Christian Marangi, Lorenzo Bianconi,
linux-pm, linux-kernel, Vitaliy Sochnev
The EN7581 IRQ is requested before the thermal zone is registered, and
the handler passes priv->tz to thermal_zone_device_update(). Unbind
leaves the monitor interrupt enabled, so an interrupt pending on the
next bind fires while priv->tz is NULL. On a Nokia XG-040G-MD this
oopses in thermal_zone_device_update(). On unbind, devres also frees the
zone before the IRQ.
Request the IRQ in post_probe, after zone registration.
Fixes: 42de37f40e1b ("thermal/drivers: Add support for Airoha EN7581 thermal sensor")
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
---
Independent of the AN7583 series v2:
https://lore.kernel.org/all/20260915191131.25214-1-sochnev.v.74@gmail.com/
drivers/thermal/airoha_thermal.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/thermal/airoha_thermal.c b/drivers/thermal/airoha_thermal.c
index 77b3a1af271f..ea3e2649c280 100644
--- a/drivers/thermal/airoha_thermal.c
+++ b/drivers/thermal/airoha_thermal.c
@@ -528,7 +528,7 @@ static int en7581_thermal_probe(struct platform_device *pdev,
struct device_node *chip_scu_np;
struct device *dev = &pdev->dev;
void __iomem *base;
- int i, irq, ret;
+ int i;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
@@ -567,16 +567,6 @@ static int en7581_thermal_probe(struct platform_device *pdev,
of_address_to_resource(chip_scu_np, 0, &priv->scu_adc_res);
of_node_put(chip_scu_np);
- irq = platform_get_irq(pdev, 0);
- if (irq < 0)
- return irq;
-
- ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
- en7581_thermal_irq, IRQF_ONESHOT,
- pdev->name, priv);
- if (ret)
- return ret;
-
en7581_thermal_setup_monitor(priv);
en7581_thermal_setup_adc_val(dev, priv);
@@ -586,6 +576,18 @@ static int en7581_thermal_probe(struct platform_device *pdev,
static int en7581_thermal_post_probe(struct platform_device *pdev)
{
struct airoha_thermal_priv *priv = platform_get_drvdata(pdev);
+ int irq, ret;
+
+ /* After zone registration: the handler uses priv->tz */
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
+ return irq;
+
+ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
+ en7581_thermal_irq, IRQF_ONESHOT,
+ pdev->name, priv);
+ if (ret)
+ return ret;
/* Enable LOW and HIGH interrupt (if supported) */
regmap_write(priv->map, EN7581_TEMPMONINT,
base-commit: b115930d716defc3a7daa2bc2ae2465d864b7114
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration
2026-09-15 19:41 [PATCH] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration Vitaliy Sochnev
@ 2026-09-18 9:24 ` Daniel Lezcano
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2026-09-18 9:24 UTC (permalink / raw)
To: Vitaliy Sochnev, Daniel Lezcano, Rafael J. Wysocki
Cc: Zhang Rui, Lukasz Luba, Christian Marangi, Lorenzo Bianconi,
linux-pm, linux-kernel
On 9/15/26 21:41, Vitaliy Sochnev wrote:
> The EN7581 IRQ is requested before the thermal zone is registered, and
> the handler passes priv->tz to thermal_zone_device_update(). Unbind
> leaves the monitor interrupt enabled, so an interrupt pending on the
> next bind fires while priv->tz is NULL. On a Nokia XG-040G-MD this
> oopses in thermal_zone_device_update(). On unbind, devres also frees the
> zone before the IRQ.
>
> Request the IRQ in post_probe, after zone registration.
>
> Fixes: 42de37f40e1b ("thermal/drivers: Add support for Airoha EN7581 thermal sensor")
> Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
> ---
Applied, thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-18 9:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 19:41 [PATCH] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration Vitaliy Sochnev
2026-09-18 9:24 ` Daniel Lezcano
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®