[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220805145729.2491611-14-daniel.lezcano@linaro.org>
Date: Fri, 5 Aug 2022 16:57:16 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: daniel.lezcano@...aro.org, rafael@...nel.org
Cc: rui.zhang@...el.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Miquel Raynal <miquel.raynal@...tlin.com>,
Amit Kucheria <amitk@...nel.org>
Subject: [PATCH v1 13/26] 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@...aro.org>
---
drivers/thermal/armada_thermal.c | 39 ++++++++++++++++----------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 52d63b3997fe..9444e5a22ca0 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -785,33 +785,34 @@ static int armada_configure_overheat_int(struct armada_thermal_priv *priv,
int sensor_id)
{
/* 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 i;
- if (!trips)
- return -EINVAL;
-
- for (i = 0; i < of_thermal_get_ntrips(tz); i++)
- if (trips[i].type == THERMAL_TRIP_CRITICAL)
- break;
+ for (i = 0; i < thermal_zone_get_num_trips(tz); i++) {
- if (i == of_thermal_get_ntrips(tz))
- return -EINVAL;
+ 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;
+ 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;
- armada_set_overheat_thresholds(priv,
- trips[i].temperature,
- trips[i].hysteresis);
- priv->overheat_sensor = tz;
- 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)
--
2.25.1
Powered by blists - more mailing lists