aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/governors/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpuidle/governors/menu.c')
-rw-r--r--drivers/cpuidle/governors/menu.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 00275244ce2f..ad0952601ae2 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -183,7 +183,7 @@ static inline int performance_multiplier(void)
183 183
184static DEFINE_PER_CPU(struct menu_device, menu_devices); 184static DEFINE_PER_CPU(struct menu_device, menu_devices);
185 185
186static void menu_update(struct cpuidle_device *dev); 186static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev);
187 187
188/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */ 188/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */
189static u64 div_round64(u64 dividend, u32 divisor) 189static u64 div_round64(u64 dividend, u32 divisor)
@@ -229,9 +229,10 @@ static void detect_repeating_patterns(struct menu_device *data)
229 229
230/** 230/**
231 * menu_select - selects the next idle state to enter 231 * menu_select - selects the next idle state to enter
232 * @drv: cpuidle driver containing state data
232 * @dev: the CPU 233 * @dev: the CPU
233 */ 234 */
234static int menu_select(struct cpuidle_device *dev) 235static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
235{ 236{
236 struct menu_device *data = &__get_cpu_var(menu_devices); 237 struct menu_device *data = &__get_cpu_var(menu_devices);
237 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); 238 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
@@ -241,7 +242,7 @@ static int menu_select(struct cpuidle_device *dev)
241 struct timespec t; 242 struct timespec t;
242 243
243 if (data->needs_update) { 244 if (data->needs_update) {
244 menu_update(dev); 245 menu_update(drv, dev);
245 data->needs_update = 0; 246 data->needs_update = 0;
246 } 247 }
247 248
@@ -286,11 +287,9 @@ static int menu_select(struct cpuidle_device *dev)
286 * Find the idle state with the lowest power while satisfying 287 * Find the idle state with the lowest power while satisfying
287 * our constraints. 288 * our constraints.
288 */ 289 */
289 for (i = CPUIDLE_DRIVER_STATE_START; i < dev->state_count; i++) { 290 for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {
290 struct cpuidle_state *s = &dev->states[i]; 291 struct cpuidle_state *s = &drv->states[i];
291 292
292 if (s->flags & CPUIDLE_FLAG_IGNORE)
293 continue;
294 if (s->target_residency > data->predicted_us) 293 if (s->target_residency > data->predicted_us)
295 continue; 294 continue;
296 if (s->exit_latency > latency_req) 295 if (s->exit_latency > latency_req)
@@ -311,26 +310,30 @@ static int menu_select(struct cpuidle_device *dev)
311/** 310/**
312 * menu_reflect - records that data structures need update 311 * menu_reflect - records that data structures need update
313 * @dev: the CPU 312 * @dev: the CPU
313 * @index: the index of actual entered state
314 * 314 *
315 * NOTE: it's important to be fast here because this operation will add to 315 * NOTE: it's important to be fast here because this operation will add to
316 * the overall exit latency. 316 * the overall exit latency.
317 */ 317 */
318static void menu_reflect(struct cpuidle_device *dev) 318static void menu_reflect(struct cpuidle_device *dev, int index)
319{ 319{
320 struct menu_device *data = &__get_cpu_var(menu_devices); 320 struct menu_device *data = &__get_cpu_var(menu_devices);
321 data->needs_update = 1; 321 data->last_state_idx = index;
322 if (index >= 0)
323 data->needs_update = 1;
322} 324}
323 325
324/** 326/**
325 * menu_update - attempts to guess what happened after entry 327 * menu_update - attempts to guess what happened after entry
328 * @drv: cpuidle driver containing state data
326 * @dev: the CPU 329 * @dev: the CPU
327 */ 330 */
328static void menu_update(struct cpuidle_device *dev) 331static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
329{ 332{
330 struct menu_device *data = &__get_cpu_var(menu_devices); 333 struct menu_device *data = &__get_cpu_var(menu_devices);
331 int last_idx = data->last_state_idx; 334 int last_idx = data->last_state_idx;
332 unsigned int last_idle_us = cpuidle_get_last_residency(dev); 335 unsigned int last_idle_us = cpuidle_get_last_residency(dev);
333 struct cpuidle_state *target = &dev->states[last_idx]; 336 struct cpuidle_state *target = &drv->states[last_idx];
334 unsigned int measured_us; 337 unsigned int measured_us;
335 u64 new_factor; 338 u64 new_factor;
336 339
@@ -384,9 +387,11 @@ static void menu_update(struct cpuidle_device *dev)
384 387
385/** 388/**
386 * menu_enable_device - scans a CPU's states and does setup 389 * menu_enable_device - scans a CPU's states and does setup
390 * @drv: cpuidle driver
387 * @dev: the CPU 391 * @dev: the CPU
388 */ 392 */
389static int menu_enable_device(struct cpuidle_device *dev) 393static int menu_enable_device(struct cpuidle_driver *drv,
394 struct cpuidle_device *dev)
390{ 395{
391 struct menu_device *data = &per_cpu(menu_devices, dev->cpu); 396 struct menu_device *data = &per_cpu(menu_devices, dev->cpu);
392 397