Skip to content

Commit 8c5ee91

Browse files
committed
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 <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 248da1f commit 8c5ee91

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

drivers/thermal/armada_thermal.c

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -782,34 +782,26 @@ static int armada_configure_overheat_int(struct armada_thermal_priv *priv,
782782
int sensor_id)
783783
{
784784
/* Retrieve the critical trip point to enable the overheat interrupt */
785-
struct thermal_trip trip;
785+
int temperature;
786786
int ret;
787-
int i;
788-
789-
for (i = 0; i < thermal_zone_get_num_trips(tz); i++) {
790-
791-
ret = thermal_zone_get_trip(tz, i, &trip);
792-
if (ret)
793-
return ret;
794-
795-
if (trip.type != THERMAL_TRIP_CRITICAL)
796-
continue;
797-
798-
ret = armada_select_channel(priv, sensor_id);
799-
if (ret)
800-
return ret;
801787

802-
armada_set_overheat_thresholds(priv, trip.temperature,
803-
trip.hysteresis);
804-
priv->overheat_sensor = tz;
805-
priv->interrupt_source = sensor_id;
788+
ret = thermal_zone_get_crit_temp(tz, &temperature);
789+
if (ret)
790+
return ret;
806791

807-
armada_enable_overheat_interrupt(priv);
792+
ret = armada_select_channel(priv, sensor_id);
793+
if (ret)
794+
return ret;
808795

809-
return 0;
810-
}
796+
/*
797+
* A critical temperature does not have a hysteresis
798+
*/
799+
armada_set_overheat_thresholds(priv, temperature, 0);
800+
priv->overheat_sensor = tz;
801+
priv->interrupt_source = sensor_id;
802+
armada_enable_overheat_interrupt(priv);
811803

812-
return -EINVAL;
804+
return 0;
813805
}
814806

815807
static int armada_thermal_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)