aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-12 20:33:28 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-20 19:26:37 +0200
commitfdcf70ed4e1606cd5a5a48f666583053ae4c3978 (patch)
treef3d2beeba9dbfbc399caa379ff843a0b8fd1ddcc /drivers/thermal
parent94be1d27aa8d6f0a9e09517445abf468de24fab3 (diff)
downloadlinux-fdcf70ed4e1606cd5a5a48f666583053ae4c3978.tar.gz
thermal: gov_step_wise: Fold update_passive_instance() into its caller
Fold update_passive_instance() into thermal_zone_trip_update() that is its only caller so as to make the code in question easier to follow. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/gov_step_wise.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
index 849dc1ec8d27c8..8bc63a1d361e75 100644
--- a/drivers/thermal/gov_step_wise.c
+++ b/drivers/thermal/gov_step_wise.c
@@ -68,17 +68,6 @@ static unsigned long get_target_state(struct thermal_instance *instance,
return next_target;
}
-static void update_passive_instance(struct thermal_zone_device *tz,
- enum thermal_trip_type type, int value)
-{
- /*
- * If value is +1, activate a passive instance.
- * If value is -1, deactivate a passive instance.
- */
- if (type == THERMAL_TRIP_PASSIVE)
- tz->passive += value;
-}
-
static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id)
{
const struct thermal_trip *trip = &tz->trips[trip_id];
@@ -109,14 +98,17 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
if (instance->initialized && old_target == instance->target)
continue;
- /* Activate a passive thermal instance */
if (old_target == THERMAL_NO_TARGET &&
- instance->target != THERMAL_NO_TARGET)
- update_passive_instance(tz, trip->type, 1);
- /* Deactivate a passive thermal instance */
- else if (old_target != THERMAL_NO_TARGET &&
- instance->target == THERMAL_NO_TARGET)
- update_passive_instance(tz, trip->type, -1);
+ instance->target != THERMAL_NO_TARGET) {
+ /* Activate a passive thermal instance */
+ if (trip->type == THERMAL_TRIP_PASSIVE)
+ tz->passive++;
+ } else if (old_target != THERMAL_NO_TARGET &&
+ instance->target == THERMAL_NO_TARGET) {
+ /* Deactivate a passive thermal instance */
+ if (trip->type == THERMAL_TRIP_PASSIVE)
+ tz->passive--;
+ }
instance->initialized = true;
mutex_lock(&instance->cdev->lock);