]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Revert "cpuidle: stop depending on pm_idle"
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 5 Aug 2011 00:46:06 +0000 (10:46 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 5 Aug 2011 00:46:06 +0000 (10:46 +1000)
This reverts commit a0bfa1373859e9d11dc92561a8667588803e42d8.

arch/arm/kernel/process.c
arch/sh/kernel/idle.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
drivers/cpuidle/cpuidle.c
include/linux/cpuidle.h

index d7ee0d4c072d8dba133b8160ef1ed590e14638a0..5e1e541972277f38a123d7964fca081629584d50 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/uaccess.h>
 #include <linux/random.h>
 #include <linux/hw_breakpoint.h>
-#include <linux/cpuidle.h>
 
 #include <asm/cacheflush.h>
 #include <asm/leds.h>
@@ -197,8 +196,7 @@ void cpu_idle(void)
                                cpu_relax();
                        } else {
                                stop_critical_timings();
-                               if (cpuidle_call_idle())
-                                       pm_idle();
+                               pm_idle();
                                start_critical_timings();
                                /*
                                 * This will eventually be removed - pm_idle
index 3c45de1db71616f4e07700b8a9459b82f376136c..84db0d6ccd0d627225c4d8fba76f6ed47edcfdd6 100644 (file)
 #include <linux/thread_info.h>
 #include <linux/irqflags.h>
 #include <linux/smp.h>
-#include <linux/cpuidle.h>
 #include <asm/pgalloc.h>
 #include <asm/system.h>
 #include <linux/atomic.h>
 #include <asm/smp.h>
 
-static void (*pm_idle)(void);
+void (*pm_idle)(void) = NULL;
 
 static int hlt_counter;
 
@@ -101,8 +100,7 @@ void cpu_idle(void)
                        local_irq_disable();
                        /* Don't trace irqs off for idle */
                        stop_critical_timings();
-                       if (cpuidle_call_idle())
-                               pm_idle();
+                       pm_idle();
                        /*
                         * Sanity check to ensure that pm_idle() returns
                         * with IRQs enabled
index 7a3b65107a27cce70ff2b20c03e909c712c32e7e..a3d0dc59067be542d7423d2a8abbc99801c0d3f6 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/kdebug.h>
-#include <linux/cpuidle.h>
 
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -110,8 +109,7 @@ void cpu_idle(void)
                        local_irq_disable();
                        /* Don't trace irqs off for idle */
                        stop_critical_timings();
-                       if (cpuidle_idle_call())
-                               pm_idle();
+                       pm_idle();
                        start_critical_timings();
                }
                tick_nohz_restart_sched_tick();
index f693e44e1bf63a303a3e53a00d927721e6602e86..ca6f7ab8df332992166d51c802216d350c8729cc 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/ftrace.h>
-#include <linux/cpuidle.h>
 
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -137,8 +136,7 @@ void cpu_idle(void)
                        enter_idle();
                        /* Don't trace irqs off for idle */
                        stop_critical_timings();
-                       if (cpuidle_idle_call())
-                               pm_idle();
+                       pm_idle();
                        start_critical_timings();
 
                        /* In many cases the interrupt that ended idle
index d4c542372886b9cc92ae732590d2404196fb6eab..041df0b056b2da57317049a4e0302869a46fac5e 100644 (file)
@@ -25,10 +25,10 @@ DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
 
 DEFINE_MUTEX(cpuidle_lock);
 LIST_HEAD(cpuidle_detected_devices);
+static void (*pm_idle_old)(void);
 
 static int enabled_devices;
 static int off __read_mostly;
-static int initialized __read_mostly;
 
 int cpuidle_disabled(void)
 {
@@ -56,23 +56,25 @@ static int __cpuidle_register_device(struct cpuidle_device *dev);
  * cpuidle_idle_call - the main idle loop
  *
  * NOTE: no locks or semaphores should be used here
- * return non-zero on failure
  */
-int cpuidle_idle_call(void)
+static void cpuidle_idle_call(void)
 {
        struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
        struct cpuidle_state *target_state;
        int next_state;
 
-       if (off)
-               return -ENODEV;
-
-       if (!initialized)
-               return -ENODEV;
-
        /* check if the device is ready */
-       if (!dev || !dev->enabled)
-               return -EBUSY;
+       if (!dev || !dev->enabled) {
+               if (pm_idle_old)
+                       pm_idle_old();
+               else
+#if defined(CONFIG_ARCH_HAS_DEFAULT_IDLE)
+                       default_idle();
+#else
+                       local_irq_enable();
+#endif
+               return;
+       }
 
 #if 0
        /* shows regressions, re-enable for 2.6.29 */
@@ -97,7 +99,7 @@ int cpuidle_idle_call(void)
        next_state = cpuidle_curr_governor->select(dev);
        if (need_resched()) {
                local_irq_enable();
-               return 0;
+               return;
        }
 
        target_state = &dev->states[next_state];
@@ -122,8 +124,6 @@ int cpuidle_idle_call(void)
        /* give the governor an opportunity to reflect on the outcome */
        if (cpuidle_curr_governor->reflect)
                cpuidle_curr_governor->reflect(dev);
-
-       return 0;
 }
 
 /**
@@ -131,10 +131,10 @@ int cpuidle_idle_call(void)
  */
 void cpuidle_install_idle_handler(void)
 {
-       if (enabled_devices) {
+       if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
                /* Make sure all changes finished before we switch to new idle */
                smp_wmb();
-               initialized = 1;
+               pm_idle = cpuidle_idle_call;
        }
 }
 
@@ -143,8 +143,8 @@ void cpuidle_install_idle_handler(void)
  */
 void cpuidle_uninstall_idle_handler(void)
 {
-       if (enabled_devices) {
-               initialized = 0;
+       if (enabled_devices && pm_idle_old && (pm_idle != pm_idle_old)) {
+               pm_idle = pm_idle_old;
                cpuidle_kick_cpus();
        }
 }
@@ -440,6 +440,8 @@ static int __init cpuidle_init(void)
        if (cpuidle_disabled())
                return -ENODEV;
 
+       pm_idle_old = pm_idle;
+
        ret = cpuidle_add_class_sysfs(&cpu_sysdev_class);
        if (ret)
                return ret;
index b51629e15cfcfee56982da848cfc8b47c77be18c..b89f67da919e1596852aa87098261a78b699dfca 100644 (file)
@@ -123,7 +123,6 @@ struct cpuidle_driver {
 
 #ifdef CONFIG_CPU_IDLE
 extern void disable_cpuidle(void);
-extern int cpuidle_idle_call(void);
 
 extern int cpuidle_register_driver(struct cpuidle_driver *drv);
 struct cpuidle_driver *cpuidle_get_driver(void);
@@ -138,7 +137,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
 
 #else
 static inline void disable_cpuidle(void) { }
-static inline int cpuidle_idle_call(void) { return -ENODEV; }
 
 static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
 {return -ENODEV; }