mirror of
https://github.com/torvalds/linux
synced 2024-10-04 10:26:40 +00:00
thermal/drivers/armada: Use generic thermal_zone_get_trip() function
The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20221003092602.1323944-15-daniel.lezcano@linaro.org
This commit is contained in:
parent
1fa86b0a36
commit
eb2bb3be13
|
@ -785,33 +785,34 @@ static int armada_configure_overheat_int(struct armada_thermal_priv *priv,
|
||||||
int sensor_id)
|
int sensor_id)
|
||||||
{
|
{
|
||||||
/* Retrieve the critical trip point to enable the overheat interrupt */
|
/* Retrieve the critical trip point to enable the overheat interrupt */
|
||||||
const struct thermal_trip *trips = of_thermal_get_trip_points(tz);
|
struct thermal_trip trip;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!trips)
|
for (i = 0; i < thermal_zone_get_num_trips(tz); i++) {
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
for (i = 0; i < of_thermal_get_ntrips(tz); i++)
|
ret = thermal_zone_get_trip(tz, i, &trip);
|
||||||
if (trips[i].type == THERMAL_TRIP_CRITICAL)
|
if (ret)
|
||||||
break;
|
return ret;
|
||||||
|
|
||||||
if (i == of_thermal_get_ntrips(tz))
|
if (trip.type != THERMAL_TRIP_CRITICAL)
|
||||||
return -EINVAL;
|
continue;
|
||||||
|
|
||||||
ret = armada_select_channel(priv, sensor_id);
|
ret = armada_select_channel(priv, sensor_id);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
armada_set_overheat_thresholds(priv,
|
armada_set_overheat_thresholds(priv, trip.temperature,
|
||||||
trips[i].temperature,
|
trip.hysteresis);
|
||||||
trips[i].hysteresis);
|
priv->overheat_sensor = tz;
|
||||||
priv->overheat_sensor = tz;
|
priv->interrupt_source = sensor_id;
|
||||||
priv->interrupt_source = sensor_id;
|
|
||||||
|
|
||||||
armada_enable_overheat_interrupt(priv);
|
armada_enable_overheat_interrupt(priv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int armada_thermal_probe(struct platform_device *pdev)
|
static int armada_thermal_probe(struct platform_device *pdev)
|
||||||
|
|
Loading…
Reference in a new issue