]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/cpuidle/cpuidle.c
hrtimer: peek at the timer queue just before going idle
[linux-2.6-omap-h63xx.git] / drivers / cpuidle / cpuidle.c
index 23554b676d6e1d348964e952705eed5f6ff7cd91..2e3148499368b8b965e6845c7627caa6ce621be4 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/cpu.h>
 #include <linux/cpuidle.h>
 #include <linux/ktime.h>
+#include <linux/hrtimer.h>
 
 #include "cpuidle.h"
 
@@ -60,6 +61,12 @@ static void cpuidle_idle_call(void)
                return;
        }
 
+       /*
+        * run any timers that can be run now, at this point
+        * before calculating the idle duration etc.
+        */
+       hrtimer_peek_ahead_timers();
+
        /* ask the governor for the next state */
        next_state = cpuidle_curr_governor->select(dev);
        if (need_resched())
@@ -94,7 +101,7 @@ void cpuidle_install_idle_handler(void)
  */
 void cpuidle_uninstall_idle_handler(void)
 {
-       if (enabled_devices && (pm_idle != pm_idle_old)) {
+       if (enabled_devices && pm_idle_old && (pm_idle != pm_idle_old)) {
                pm_idle = pm_idle_old;
                cpuidle_kick_cpus();
        }
@@ -340,7 +347,7 @@ static void smp_callback(void *v)
 static int cpuidle_latency_notify(struct notifier_block *b,
                unsigned long l, void *v)
 {
-       smp_call_function(smp_callback, NULL, 0, 1);
+       smp_call_function(smp_callback, NULL, 1);
        return NOTIFY_OK;
 }