From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Yaohan Li <shunsheng1218@gmail.com>
Cc: rafael@kernel.org, daniel.lezcano@kernel.org,
rui.zhang@intel.com, lukasz.luba@arm.com,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
edubezval@gmail.com
Subject: Re: [PATCH] thermal/drivers/armada: free the overheat IRQ before the zones are gone
Date: Wed, 18 Nov 2026 10:29:54 +0100 [thread overview]
Message-ID: <87ld6qjxm5.fsf@bootlin.com> (raw)
In-Reply-To: <20261118072339.1259719-1-shunsheng1218@gmail.com> (Yaohan Li's message of "Wed, 18 Nov 2026 15:23:39 +0800")
On 18/11/2026 at 15:23:39 +08, Yaohan Li <shunsheng1218@gmail.com> wrote:
> The overheat interrupt is requested before the thermal zones are
> registered, so devres releases the zones first and the interrupt
> afterwards. armada_overheat_isr_thread() calls
> thermal_zone_device_update() on priv->overheat_sensor, which by then has
> been unregistered and freed, and thermal_zone_device_update() locks the
> zone mutex unconditionally.
>
> The handler also polls the sensor once per second until the temperature
> drops below the threshold. If that poll is still running when the
> device goes away, free_irq() waits for it and the removal is blocked for
> as long as the sensor stays hot.
>
> The same handler runs while priv->overheat_sensor is still NULL, because
> the interrupt is requested before the zones exist and a spurious
> interrupt in that window passes a NULL zone to
> thermal_zone_device_update().
>
> Move the teardown into armada_thermal_quiesce_irq(), which disables the
> interrupt, frees it and tells the poll loop to give up, and call it from
> ->remove(). The same helper is called from the probe rollback once the
> interrupt has been requested: the driver core does not run ->remove()
> for a probe that fails, while devres still frees the zones and the
> private data of an interface whose handler is registered.
>
> Read the zone once at the top of the thread and bail out when it is not
> published yet or the driver is shutting down, and reuse that pointer for
> both thermal_zone_device_update() calls.
>
> Fixes: 879d7362d1d0 ("thermal: armada: add overheat interrupt support")
> Signed-off-by: Yaohan Li <shunsheng1218@gmail.com>
Your solution is over-engineered. For a case simple like that, you would
need to just move the IRQ registration (not the get_irq()) after the
zones registration.
Maybe you need a shutdown boolean as well, but clearly not all the extra
complexity you are trying to add.
Thanks,
Miquèl
prev parent reply other threads:[~2026-11-18 9:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 7:23 [PATCH] thermal/drivers/armada: free the overheat IRQ before the zones are gone Yaohan Li
2026-11-18 9:29 ` Miquel Raynal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ld6qjxm5.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=daniel.lezcano@kernel.org \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=shunsheng1218@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox