summaryrefslogtreecommitdiff
path: root/drivers/thermal/gov_step_wise.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-12 21:34:50 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-20 20:26:37 +0300
commit8c35b1f472533b0df1b8f1f1afcaf4395cdb2256 (patch)
tree00be096e40c553e3912fbc9ad62190d555b41421 /drivers/thermal/gov_step_wise.c
parentfdcf70ed4e1606cd5a5a48f666583053ae4c3978 (diff)
downloadlinux-8c35b1f472533b0df1b8f1f1afcaf4395cdb2256.tar.xz
thermal: core: Pass trip pointer to governor throttle callback
Modify the governor .throttle() callback definition so that it takes a trip pointer instead of a trip index as its second argument, adjust the governors accordingly and update the core code invoking .throttle(). This causes the governors to become independent of the representation of the list of trips in the thermal zone structure. This change is not expected to alter the general functionality. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/thermal/gov_step_wise.c')
-rw-r--r--drivers/thermal/gov_step_wise.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
index 8bc63a1d361e..5436aa58d41e 100644
--- a/drivers/thermal/gov_step_wise.c
+++ b/drivers/thermal/gov_step_wise.c
@@ -68,15 +68,16 @@ static unsigned long get_target_state(struct thermal_instance *instance,
return next_target;
}
-static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id)
+static void thermal_zone_trip_update(struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
- const struct thermal_trip *trip = &tz->trips[trip_id];
+ int trip_id = thermal_zone_trip_id(tz, trip);
enum thermal_trend trend;
struct thermal_instance *instance;
bool throttle = false;
int old_target;
- trend = get_tz_trend(tz, trip_id);
+ trend = get_tz_trend(tz, trip);
if (tz->temperature >= trip->temperature) {
throttle = true;
@@ -120,7 +121,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
/**
* step_wise_throttle - throttles devices associated with the given zone
* @tz: thermal_zone_device
- * @trip: trip point index
+ * @trip: trip point
*
* Throttling Logic: This uses the trend of the thermal zone to throttle.
* If the thermal zone is 'heating up' this throttles all the cooling
@@ -128,7 +129,8 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
* step. If the zone is 'cooling down' it brings back the performance of
* the devices by one step.
*/
-static int step_wise_throttle(struct thermal_zone_device *tz, int trip)
+static int step_wise_throttle(struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
struct thermal_instance *instance;