Skip to content

Commit 41ddbcc

Browse files
committed
thermal: gov_power_allocator: Use .manage() callback instead of .throttle()
The Power Allocator governor really only wants to be called once per thermal zone update and it does a special check to skip the extra, from its perspective, invocations of the .throttle() callback. Make it use .manage() instead of .throttle(). Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]>
1 parent 976f441 commit 41ddbcc

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

drivers/thermal/gov_power_allocator.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static void divvy_up_power(struct power_actor *power, int num_actors,
395395
}
396396
}
397397

398-
static int allocate_power(struct thermal_zone_device *tz, int control_temp)
398+
static void allocate_power(struct thermal_zone_device *tz, int control_temp)
399399
{
400400
struct power_allocator_params *params = tz->governor_data;
401401
unsigned int num_actors = params->num_actors;
@@ -410,7 +410,7 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp)
410410
int i = 0, ret;
411411

412412
if (!num_actors)
413-
return -ENODEV;
413+
return;
414414

415415
/* Clean all buffers for new power estimations */
416416
memset(power, 0, params->buffer_size);
@@ -471,8 +471,6 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp)
471471
num_actors, power_range,
472472
max_allocatable_power, tz->temperature,
473473
control_temp - tz->temperature);
474-
475-
return 0;
476474
}
477475

478476
/**
@@ -745,40 +743,32 @@ static void power_allocator_unbind(struct thermal_zone_device *tz)
745743
tz->governor_data = NULL;
746744
}
747745

748-
static int power_allocator_throttle(struct thermal_zone_device *tz,
749-
const struct thermal_trip *trip)
746+
static void power_allocator_manage(struct thermal_zone_device *tz)
750747
{
751748
struct power_allocator_params *params = tz->governor_data;
749+
const struct thermal_trip *trip = params->trip_switch_on;
752750
bool update;
753751

754752
lockdep_assert_held(&tz->lock);
755753

756-
/*
757-
* We get called for every trip point but we only need to do
758-
* our calculations once
759-
*/
760-
if (trip != params->trip_max)
761-
return 0;
762-
763-
trip = params->trip_switch_on;
764754
if (trip && tz->temperature < trip->temperature) {
765755
update = tz->passive;
766756
tz->passive = 0;
767757
reset_pid_controller(params);
768758
allow_maximum_power(tz, update);
769-
return 0;
759+
return;
770760
}
771761

772762
tz->passive = 1;
773763

774-
return allocate_power(tz, params->trip_max->temperature);
764+
allocate_power(tz, params->trip_max->temperature);
775765
}
776766

777767
static struct thermal_governor thermal_gov_power_allocator = {
778768
.name = "power_allocator",
779769
.bind_to_tz = power_allocator_bind,
780770
.unbind_from_tz = power_allocator_unbind,
781-
.throttle = power_allocator_throttle,
771+
.manage = power_allocator_manage,
782772
.update_tz = power_allocator_update_tz,
783773
};
784774
THERMAL_GOVERNOR_DECLARE(thermal_gov_power_allocator);

0 commit comments

Comments
 (0)