@@ -233,7 +233,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
233
233
{
234
234
struct teo_cpu * cpu_data = per_cpu_ptr (& teo_cpus , dev -> cpu );
235
235
int latency_req = cpuidle_governor_latency_req (dev -> cpu );
236
- unsigned int duration_us , count ;
236
+ unsigned int duration_us , early_hits ;
237
237
int max_early_idx , constraint_idx , idx , i ;
238
238
ktime_t delta_tick ;
239
239
@@ -247,7 +247,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
247
247
cpu_data -> sleep_length_ns = tick_nohz_get_sleep_length (& delta_tick );
248
248
duration_us = ktime_to_us (cpu_data -> sleep_length_ns );
249
249
250
- count = 0 ;
250
+ early_hits = 0 ;
251
251
max_early_idx = -1 ;
252
252
constraint_idx = drv -> state_count ;
253
253
idx = -1 ;
@@ -270,12 +270,12 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
270
270
* into account, because it would be a mistake to select
271
271
* a deeper state with lower "early hits" metric. The
272
272
* index cannot be changed to point to it, however, so
273
- * just increase the max count alone and let the index
274
- * still point to a shallower idle state.
273
+ * just increase the "early hits" count alone and let
274
+ * the index still point to a shallower idle state.
275
275
*/
276
276
if (max_early_idx >= 0 &&
277
- count < cpu_data -> states [i ].early_hits )
278
- count = cpu_data -> states [i ].early_hits ;
277
+ early_hits < cpu_data -> states [i ].early_hits )
278
+ early_hits = cpu_data -> states [i ].early_hits ;
279
279
280
280
continue ;
281
281
}
@@ -291,10 +291,10 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
291
291
292
292
idx = i ;
293
293
294
- if (count < cpu_data -> states [i ].early_hits &&
294
+ if (early_hits < cpu_data -> states [i ].early_hits &&
295
295
!(tick_nohz_tick_stopped () &&
296
296
drv -> states [i ].target_residency < TICK_USEC )) {
297
- count = cpu_data -> states [i ].early_hits ;
297
+ early_hits = cpu_data -> states [i ].early_hits ;
298
298
max_early_idx = i ;
299
299
}
300
300
}
@@ -323,10 +323,9 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
323
323
if (idx < 0 ) {
324
324
idx = 0 ; /* No states enabled. Must use 0. */
325
325
} else if (idx > 0 ) {
326
+ unsigned int count = 0 ;
326
327
u64 sum = 0 ;
327
328
328
- count = 0 ;
329
-
330
329
/*
331
330
* Count and sum the most recent idle duration values less than
332
331
* the current expected idle duration value.
0 commit comments