[PATCH v2 4/6] thermal/drivers/samsung: acpm-tmu: OR pending bits

André Draszik andre.draszik at linaro.org
Fri Dec 4 02:05:26 PST 2026


Each probe of a sensor group has its own pending register, so stopping
at the first non-zero probe in acpm_tmu_clear_pending_irq() prevents
the interrupt handler from seeing which comparators fired across the
group.

OR the pending registers of all probes of the group and return the
result. No functional change intended: the handler still clears the
interrupt and notifies the thermal core if any bit is pending.
"thermal/drivers/samsung: acpm-tmu: fix IRQ storm" uses the returned
bits to decide whether to notify the thermal core.

Signed-off-by: André Draszik <andre.draszik at linaro.org>
---
 drivers/thermal/samsung/acpm-tmu.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/thermal/samsung/acpm-tmu.c b/drivers/thermal/samsung/acpm-tmu.c
index 08856d713d5d..56f0b6c70519 100644
--- a/drivers/thermal/samsung/acpm-tmu.c
+++ b/drivers/thermal/samsung/acpm-tmu.c
@@ -393,12 +393,12 @@ static const struct thermal_zone_device_ops acpm_tmu_sensor_ops = {
 	.set_trip_temp = acpm_tmu_set_trip_temp,
 };
 
-static bool acpm_tmu_clear_pending_irq(struct acpm_tmu_sensor *sensor)
+static u32 acpm_tmu_clear_pending_irq(struct acpm_tmu_sensor *sensor)
 {
 	struct acpm_tmu_priv *priv = sensor->priv;
 	const struct acpm_tmu_ops *ops = &priv->handle->ops->tmu;
 	unsigned long mask = sensor->group->mask;
-	bool pending_irq = false;
+	u32 pending = 0;
 	int i, ret;
 	u32 val;
 
@@ -407,16 +407,13 @@ static bool acpm_tmu_clear_pending_irq(struct acpm_tmu_sensor *sensor)
 	for_each_set_bit(i, &mask, EXYNOS_TMU_SENSORS_MAX_COUNT) {
 		ret = regmap_field_read(priv->regmap_fields[i], &val);
 		if (ret)
-			return false;
+			return 0;
 
-		if (val) {
-			pending_irq = true;
-			break;
-		}
+		pending |= val;
 	}
 
-	if (!pending_irq)
-		return false;
+	if (!pending)
+		return 0;
 
 	ret = ops->clear_tz_irq(priv->handle, priv->mbox_chan_id,
 				sensor->group->id);
@@ -424,10 +421,10 @@ static bool acpm_tmu_clear_pending_irq(struct acpm_tmu_sensor *sensor)
 		dev_err_ratelimited(priv->dev,
 				    "Sensor %u: failed to clear IRQ (%d)\n",
 				    sensor->group->id, ret);
-		return false;
+		return 0;
 	}
 
-	return true;
+	return pending;
 }
 
 static irqreturn_t acpm_tmu_thread_fn(int irq, void *id)

-- 
2.56.1.915.g69d5ec7298-goog




More information about the linux-arm-kernel mailing list