Skip to content

Commit ca0e972

Browse files
committed
thermal: gov_power_allocator: Eliminate a redundant variable
Notice that the passive field in struct thermal_zone_device is not used by the Power Allocator governor itself and so the ordering of its updates with respect to allow_maximum_power() or allocate_power() does not matter. Accordingly, make power_allocator_manage() update that field right before returning, which allows the current value of it to be passed directly to allow_maximum_power() without using the additional update variable that can be dropped. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]>
1 parent 41ddbcc commit ca0e972

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/thermal/gov_power_allocator.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -747,21 +747,18 @@ static void power_allocator_manage(struct thermal_zone_device *tz)
747747
{
748748
struct power_allocator_params *params = tz->governor_data;
749749
const struct thermal_trip *trip = params->trip_switch_on;
750-
bool update;
751750

752751
lockdep_assert_held(&tz->lock);
753752

754753
if (trip && tz->temperature < trip->temperature) {
755-
update = tz->passive;
756-
tz->passive = 0;
757754
reset_pid_controller(params);
758-
allow_maximum_power(tz, update);
755+
allow_maximum_power(tz, tz->passive);
756+
tz->passive = 0;
759757
return;
760758
}
761759

762-
tz->passive = 1;
763-
764760
allocate_power(tz, params->trip_max->temperature);
761+
tz->passive = 1;
765762
}
766763

767764
static struct thermal_governor thermal_gov_power_allocator = {

0 commit comments

Comments
 (0)