Skip to content

Commit f53cbda

Browse files
committed
cpuidle: teo: Cosmetic modifications of teo_update()
Rename a local variable in teo_update() so that its purpose is better reflected by its name and use one more local variable in the loop over the CPU idle states in that function to make the code somewhat easier to read. No functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 6423333 commit f53cbda

File tree

1 file changed

+7
-6
lines changed
  • drivers/cpuidle/governors

1 file changed

+7
-6
lines changed

drivers/cpuidle/governors/teo.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static DEFINE_PER_CPU(struct teo_cpu, teo_cpus);
117117
static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
118118
{
119119
struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, dev->cpu);
120-
int i, idx_hit = 0, idx_timer = 0;
120+
int i, idx_timer = 0, idx_duration = 0;
121121
unsigned int hits, misses;
122122
u64 measured_ns;
123123

@@ -156,14 +156,15 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
156156
* states matching the sleep length and the measured idle duration.
157157
*/
158158
for (i = 0; i < drv->state_count; i++) {
159+
s64 target_residency_ns = drv->states[i].target_residency_ns;
159160
unsigned int early_hits = cpu_data->states[i].early_hits;
160161

161162
cpu_data->states[i].early_hits -= early_hits >> DECAY_SHIFT;
162163

163-
if (drv->states[i].target_residency_ns <= cpu_data->sleep_length_ns) {
164+
if (target_residency_ns <= cpu_data->sleep_length_ns) {
164165
idx_timer = i;
165-
if (drv->states[i].target_residency_ns <= measured_ns)
166-
idx_hit = i;
166+
if (target_residency_ns <= measured_ns)
167+
idx_duration = i;
167168
}
168169
}
169170

@@ -181,11 +182,11 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
181182
misses = cpu_data->states[idx_timer].misses;
182183
misses -= misses >> DECAY_SHIFT;
183184

184-
if (idx_timer == idx_hit) {
185+
if (idx_timer == idx_duration) {
185186
hits += PULSE;
186187
} else {
187188
misses += PULSE;
188-
cpu_data->states[idx_hit].early_hits += PULSE;
189+
cpu_data->states[idx_duration].early_hits += PULSE;
189190
}
190191

191192
cpu_data->states[idx_timer].misses = misses;

0 commit comments

Comments
 (0)