thermal: gov_power_allocator: Set up trip points earlier
Set up the trip points at the beginning of the binding function. This simplifies the code a bit and allows for further cleanups. Also add a check to fail the binding if the last passive trip point is not found. Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
4e6d4687f7
commit
e83747c2f8
1 changed files with 17 additions and 10 deletions
|
@ -617,14 +617,24 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
|
||||||
int ret;
|
int ret;
|
||||||
struct power_allocator_params *params;
|
struct power_allocator_params *params;
|
||||||
|
|
||||||
ret = check_power_actors(tz);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
||||||
if (!params)
|
if (!params)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
get_governor_trips(tz, params);
|
||||||
|
if (!params->trip_max) {
|
||||||
|
dev_warn(&tz->device, "power_allocator: missing trip_max\n");
|
||||||
|
kfree(params);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = check_power_actors(tz);
|
||||||
|
if (ret) {
|
||||||
|
dev_warn(&tz->device, "power_allocator: binding failed\n");
|
||||||
|
kfree(params);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (!tz->tzp) {
|
if (!tz->tzp) {
|
||||||
tz->tzp = kzalloc(sizeof(*tz->tzp), GFP_KERNEL);
|
tz->tzp = kzalloc(sizeof(*tz->tzp), GFP_KERNEL);
|
||||||
if (!tz->tzp) {
|
if (!tz->tzp) {
|
||||||
|
@ -638,9 +648,6 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
|
||||||
if (!tz->tzp->sustainable_power)
|
if (!tz->tzp->sustainable_power)
|
||||||
dev_warn(&tz->device, "power_allocator: sustainable_power will be estimated\n");
|
dev_warn(&tz->device, "power_allocator: sustainable_power will be estimated\n");
|
||||||
|
|
||||||
get_governor_trips(tz, params);
|
|
||||||
|
|
||||||
if (params->trip_max)
|
|
||||||
estimate_pid_constants(tz, tz->tzp->sustainable_power,
|
estimate_pid_constants(tz, tz->tzp->sustainable_power,
|
||||||
params->trip_switch_on,
|
params->trip_switch_on,
|
||||||
params->trip_max->temperature);
|
params->trip_max->temperature);
|
||||||
|
|
Loading…
Add table
Reference in a new issue