Skip to content

Commit 1ec52c1

Browse files
nfrapradodlezcano
authored andcommitted
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 <[email protected]> Signed-off-by: Nícolas F. R. A. Prado <[email protected]> Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-5-07a25200c7c6@collabora.com Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 2738fb3 commit 1ec52c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static void lvts_update_irq_mask(struct lvts_ctrl *lvts_ctrl)
346346

347347
value = readl(LVTS_MONINT(lvts_ctrl->base));
348348

349-
for (i = 0; i < ARRAY_SIZE(masks); i++) {
349+
lvts_for_each_valid_sensor(i, lvts_ctrl) {
350350
if (lvts_ctrl->sensors[i].high_thresh == lvts_ctrl->high_thresh
351351
&& lvts_ctrl->sensors[i].low_thresh == lvts_ctrl->low_thresh) {
352352
/*

0 commit comments

Comments
 (0)