]> www.infradead.org Git - users/jedix/linux-maple.git/commit
thermal/drivers/mediatek/lvts: Only update IRQ enable for valid sensors
authorNĂ­colas F. R. A. Prado <nfraprado@collabora.com>
Mon, 13 Jan 2025 13:27:16 +0000 (10:27 -0300)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 25 Mar 2025 19:52:04 +0000 (20:52 +0100)
commit1ec52c157b4298986257c0380bfcfe72e05c7c9b
tree58e062d920c9e0f8876a4f362329f6d481ed209e
parent2738fb3ec6838a10d2c4ce65cefdb3b90b11bd61
thermal/drivers/mediatek/lvts: Only update IRQ enable for valid sensors

Only sensors that are valid need to have their interrupts enable status
updated based on their thresholds. Use the lvts_for_each_valid_sensor()
helper in lvts_update_irq_mask() to ignore invalid sensors.

Currently, since the invalid sensors will always contain zeroed out
thresholds (from kzalloc), they will always get their interrupts
disabled on this loop. So this commit doesn't change the resulting
interrupts configuration, but it slightly optimizes the loop by skipping
the invalid sensors, avoids potential future surprises if at some point
memory is no longer allocated for invalid sensors, as well as makes the
code more obvious.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-5-07a25200c7c6@collabora.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/mediatek/lvts_thermal.c