Re: [PATCH v3] thermal/drivers/armada: request the overheat IRQ before enabling the source

From: Miquel Raynal

Date: Fri Nov 20 2026 - 03:27:55 EST


On 20/11/2026 at 12:27:28 +08, Yaohan Li <shunsheng1218@xxxxxxxxx> wrote:

> armada_thermal_probe() requests the overheat interrupt before it registers
> the thermal zones. Devres releases resources in the reverse order, so the
> zones are unregistered first and the interrupt is freed afterwards: a
> handler that is still running, or that fires in the window between the
> two, passes a zone that has already been destroyed to
> thermal_zone_device_update().
>
> Request the interrupt after the zone loop instead. The handler is then
> freed before the zones it updates, and the interrupt is only requested
> when a critical trip point was found, which is the only case in which the
> driver has an overheat source to enable.
>
> The interrupt stays optional, as before: apart from -EPROBE_DEFER, an
> unavailable or invalid IRQ number does not fail the probe, it only leaves
> the device without overheat interrupt handling.
>
> The source has to be enabled after the handler is registered, so
> armada_configure_overheat_int() only programs the thresholds now and
> armada_thermal_probe() enables the source once the request has succeeded.
> A failed request then cannot leave an interrupt enabled that nobody
> handles.
>
> The zones are now registered while the source is still masked, so the
> driver masks it at probe time on the variants that describe the overheat
> interrupt as a DFX cause: a firmware that left it enabled would otherwise
> raise an interrupt that nobody handles until the request below. The mask
> is released when the request succeeds.
>
> ->remove() masks the source and sets a shutdown flag so that the poll loop
> gives up instead of keeping the removal blocked until the sensor cools
> down.
>
> Fixes: 879d7362d1d0 ("thermal: armada: add overheat interrupt support")
> Signed-off-by: Yaohan Li <shunsheng1218@xxxxxxxxx>

Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>