summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2023-10-25 20:22:25 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-11-28 16:02:14 +0100
commit401888e7206778db54b79e6b3c25a2f1461413e6 (patch)
treeff596cd7c06a0896029e45f0e76f7eb204c972bb /drivers/thermal
parent0458d536ae97c5107b81810778d050da04d83fa2 (diff)
thermal: gov_power_allocator: Rearrange initialization of local variables
Rearrange the initialization of local variables in allocate_power() so as to improve code clarity and the visibility of the initial values. This change is not expected to alter the general functionality. Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/gov_power_allocator.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index e6d2f0fe8d2f..785fff14223d 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -376,16 +376,19 @@ static void divvy_up_power(u32 *req_power, u32 *max_power, int num_actors,
static int allocate_power(struct thermal_zone_device *tz, int control_temp)
{
- u32 total_req_power, max_allocatable_power, total_weighted_req_power;
u32 *req_power, *max_power, *granted_power, *extra_actor_power;
struct power_allocator_params *params = tz->governor_data;
- u32 total_granted_power, power_range;
struct thermal_cooling_device *cdev;
struct thermal_instance *instance;
+ u32 total_weighted_req_power = 0;
+ u32 max_allocatable_power = 0;
+ u32 total_granted_power = 0;
+ u32 total_req_power = 0;
u32 *weighted_req_power;
+ u32 power_range, weight;
int total_weight = 0;
int num_actors = 0;
- int i, weight;
+ int i = 0;
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
if ((instance->trip == params->trip_max) &&
@@ -418,11 +421,6 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp)
extra_actor_power = &req_power[3 * num_actors];
weighted_req_power = &req_power[4 * num_actors];
- i = 0;
- total_weighted_req_power = 0;
- total_req_power = 0;
- max_allocatable_power = 0;
-
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
cdev = instance->cdev;
@@ -459,7 +457,6 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp)
total_weighted_req_power, power_range, granted_power,
extra_actor_power);
- total_granted_power = 0;
i = 0;
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
if (instance->trip != params->trip_max)