aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/governors
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpuidle/governors')
-rw-r--r--drivers/cpuidle/governors/ladder.c4
-rw-r--r--drivers/cpuidle/governors/menu.c18
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index 9f08e8cce1af..044ee0df5871 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -144,7 +144,7 @@ static int ladder_enable_device(struct cpuidle_driver *drv,
144 144
145 ldev->last_state_idx = CPUIDLE_DRIVER_STATE_START; 145 ldev->last_state_idx = CPUIDLE_DRIVER_STATE_START;
146 146
147 for (i = 0; i < drv->state_count; i++) { 147 for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {
148 state = &drv->states[i]; 148 state = &drv->states[i];
149 lstate = &ldev->states[i]; 149 lstate = &ldev->states[i];
150 150
@@ -156,7 +156,7 @@ static int ladder_enable_device(struct cpuidle_driver *drv,
156 156
157 if (i < drv->state_count - 1) 157 if (i < drv->state_count - 1)
158 lstate->threshold.promotion_time = state->exit_latency; 158 lstate->threshold.promotion_time = state->exit_latency;
159 if (i > 0) 159 if (i > CPUIDLE_DRIVER_STATE_START)
160 lstate->threshold.demotion_time = state->exit_latency; 160 lstate->threshold.demotion_time = state->exit_latency;
161 } 161 }
162 162
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index daf850250b6a..ae5a42595e1c 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -35,7 +35,6 @@
35#define RESOLUTION 1024 35#define RESOLUTION 1024
36#define DECAY 8 36#define DECAY 8
37#define MAX_INTERESTING 50000 37#define MAX_INTERESTING 50000
38#define STDDEV_THRESH 400
39 38
40 39
41/* 40/*
@@ -296,7 +295,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
296 data->needs_update = 0; 295 data->needs_update = 0;
297 } 296 }
298 297
299 data->last_state_idx = 0; 298 data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1;
300 299
301 /* Special case when user has set very strict latency requirement */ 300 /* Special case when user has set very strict latency requirement */
302 if (unlikely(latency_req == 0)) 301 if (unlikely(latency_req == 0))
@@ -311,13 +310,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
311 data->bucket = which_bucket(data->next_timer_us); 310 data->bucket = which_bucket(data->next_timer_us);
312 311
313 /* 312 /*
314 * if the correction factor is 0 (eg first time init or cpu hotplug
315 * etc), we actually want to start out with a unity factor.
316 */
317 if (data->correction_factor[data->bucket] == 0)
318 data->correction_factor[data->bucket] = RESOLUTION * DECAY;
319
320 /*
321 * Force the result of multiplication to be 64 bits even if both 313 * Force the result of multiplication to be 64 bits even if both
322 * operands are 32 bits. 314 * operands are 32 bits.
323 * Make sure to round up for half microseconds. 315 * Make sure to round up for half microseconds.
@@ -466,9 +458,17 @@ static int menu_enable_device(struct cpuidle_driver *drv,
466 struct cpuidle_device *dev) 458 struct cpuidle_device *dev)
467{ 459{
468 struct menu_device *data = &per_cpu(menu_devices, dev->cpu); 460 struct menu_device *data = &per_cpu(menu_devices, dev->cpu);
461 int i;
469 462
470 memset(data, 0, sizeof(struct menu_device)); 463 memset(data, 0, sizeof(struct menu_device));
471 464
465 /*
466 * if the correction factor is 0 (eg first time init or cpu hotplug
467 * etc), we actually want to start out with a unity factor.
468 */
469 for(i = 0; i < BUCKETS; i++)
470 data->correction_factor[i] = RESOLUTION * DECAY;
471
472 return 0; 472 return 0;
473} 473}
474 474