]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/cpuidle/governors/menu.c
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / drivers / cpuidle / governors / menu.c
index 71b52329335472b7a888e16b4075c6ea7a4f58c5..c4f80c15a48dde7be9e16898b09f008e5d0c28fd 100644 (file)
@@ -296,7 +296,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
                data->needs_update = 0;
        }
 
-       data->last_state_idx = 0;
+       data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1;
 
        /* Special case when user has set very strict latency requirement */
        if (unlikely(latency_req == 0))
@@ -310,13 +310,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 
        data->bucket = which_bucket(data->next_timer_us);
 
-       /*
-        * if the correction factor is 0 (eg first time init or cpu hotplug
-        * etc), we actually want to start out with a unity factor.
-        */
-       if (data->correction_factor[data->bucket] == 0)
-               data->correction_factor[data->bucket] = RESOLUTION * DECAY;
-
        /*
         * Force the result of multiplication to be 64 bits even if both
         * operands are 32 bits.
@@ -466,9 +459,17 @@ static int menu_enable_device(struct cpuidle_driver *drv,
                                struct cpuidle_device *dev)
 {
        struct menu_device *data = &per_cpu(menu_devices, dev->cpu);
+       int i;
 
        memset(data, 0, sizeof(struct menu_device));
 
+       /*
+        * if the correction factor is 0 (eg first time init or cpu hotplug
+        * etc), we actually want to start out with a unity factor.
+        */
+       for(i = 0; i < BUCKETS; i++)
+               data->correction_factor[i] = RESOLUTION * DECAY;
+
        return 0;
 }