Skip to content

Commit 78aabcb

Browse files
committed
cpuidle: teo: Avoid unnecessary variable assignments
Notice that it is not necessary to assign tick_intercept_sum in every iteration of the first loop over idle states in teo_select(), because the intercept_sum value does not change after the assignment in a given iteration of the loop, so its value after the last iteration of the loop can be used for computing the tick_intercept_sum value directly. Modify the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 5484e31 commit 78aabcb

File tree

1 file changed

+2
-3
lines changed
  • drivers/cpuidle/governors

1 file changed

+2
-3
lines changed

drivers/cpuidle/governors/teo.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,6 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
450450
hit_sum += prev_bin->hits;
451451
recent_sum += prev_bin->recent;
452452

453-
tick_intercept_sum = intercept_sum;
454-
455453
if (dev->states_usage[i].disable)
456454
continue;
457455

@@ -484,7 +482,8 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
484482
goto end;
485483
}
486484

487-
tick_intercept_sum += cpu_data->state_bins[drv->state_count-1].intercepts;
485+
tick_intercept_sum = intercept_sum +
486+
cpu_data->state_bins[drv->state_count-1].intercepts;
488487

489488
/*
490489
* If the sum of the intercepts metric for all of the idle states

0 commit comments

Comments
 (0)