summaryrefslogtreecommitdiff
path: root/drivers/thermal/armada_thermal.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2023-01-18 23:26:10 +0100
committerDaniel Lezcano <daniel.lezcano@linaro.org>2023-01-24 12:37:56 +0100
commit8c5ee9155f8ae133070b40ee4be03cafb35c188d (patch)
treefacb17705968d741381579412548ae2fe6f99bae /drivers/thermal/armada_thermal.c
parent248da1fc8418c732e98726fe570d4db01385562d (diff)
thermal/drivers/armada: Use the thermal_zone_get_crit_temp()
The driver browses the trip point to find out the critical trip temperature. However the function thermal_zone_get_crit_temp() does already that, so the routine is pointless in the driver. Use thermal_zone_get_crit_temp() instead of inspecting all the trip points. In addition, the hysteresis value is set to zero. A critical trip point does not have a hysteresis. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20230118222610.186088-1-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/thermal/armada_thermal.c')
-rw-r--r--drivers/thermal/armada_thermal.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 7d2682e8ef96..99e86484a55c 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -782,34 +782,26 @@ static int armada_configure_overheat_int(struct armada_thermal_priv *priv,
int sensor_id)
{
/* Retrieve the critical trip point to enable the overheat interrupt */
- struct thermal_trip trip;
+ int temperature;
int ret;
- int i;
-
- for (i = 0; i < thermal_zone_get_num_trips(tz); i++) {
-
- ret = thermal_zone_get_trip(tz, i, &trip);
- if (ret)
- return ret;
-
- if (trip.type != THERMAL_TRIP_CRITICAL)
- continue;
-
- ret = armada_select_channel(priv, sensor_id);
- if (ret)
- return ret;
- armada_set_overheat_thresholds(priv, trip.temperature,
- trip.hysteresis);
- priv->overheat_sensor = tz;
- priv->interrupt_source = sensor_id;
+ ret = thermal_zone_get_crit_temp(tz, &temperature);
+ if (ret)
+ return ret;
- armada_enable_overheat_interrupt(priv);
+ ret = armada_select_channel(priv, sensor_id);
+ if (ret)
+ return ret;
- return 0;
- }
+ /*
+ * A critical temperature does not have a hysteresis
+ */
+ armada_set_overheat_thresholds(priv, temperature, 0);
+ priv->overheat_sensor = tz;
+ priv->interrupt_source = sensor_id;
+ armada_enable_overheat_interrupt(priv);
- return -EINVAL;
+ return 0;
}
static int armada_thermal_probe(struct platform_device *pdev)