Skip to content

Commit 97584d1

Browse files
JaviMerinozhang-rui
authored andcommitted
thermal: power_allocator: exit early if there are no cooling devices
Don't waste cycles in the power allocator governor's throttle function if there are no cooling devices and exit early. This commit doesn't change any functionality, but should provide better performance for the odd case of a thermal zone with trip points but without cooling devices. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
1 parent f5cbb18 commit 97584d1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎drivers/thermal/power_allocator.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,11 @@ static int allocate_power(struct thermal_zone_device *tz,
346346
}
347347
}
348348

349+
if (!num_actors) {
350+
ret = -ENODEV;
351+
goto unlock;
352+
}
353+
349354
/*
350355
* We need to allocate five arrays of the same size:
351356
* req_power, max_power, granted_power, extra_actor_power and

0 commit comments

Comments
 (0)