Commit fdcf70ed authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
parent 94be1d27
...@@ -68,17 +68,6 @@ static unsigned long get_target_state(struct thermal_instance *instance, ...@@ -68,17 +68,6 @@ static unsigned long get_target_state(struct thermal_instance *instance,
return next_target; 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) static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id)
{ {
const struct thermal_trip *trip = &tz->trips[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 ...@@ -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) if (instance->initialized && old_target == instance->target)
continue; continue;
/* Activate a passive thermal instance */
if (old_target == THERMAL_NO_TARGET && if (old_target == THERMAL_NO_TARGET &&
instance->target != THERMAL_NO_TARGET) instance->target != THERMAL_NO_TARGET) {
update_passive_instance(tz, trip->type, 1); /* Activate a passive thermal instance */
/* Deactivate a passive thermal instance */ if (trip->type == THERMAL_TRIP_PASSIVE)
else if (old_target != THERMAL_NO_TARGET && tz->passive++;
instance->target == THERMAL_NO_TARGET) } else if (old_target != THERMAL_NO_TARGET &&
update_passive_instance(tz, trip->type, -1); instance->target == THERMAL_NO_TARGET) {
/* Deactivate a passive thermal instance */
if (trip->type == THERMAL_TRIP_PASSIVE)
tz->passive--;
}
instance->initialized = true; instance->initialized = true;
mutex_lock(&instance->cdev->lock); mutex_lock(&instance->cdev->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment