Merge branches 'acpi_pad', 'acpica', 'apei-bugzilla-43282', 'battery', 'cpuidle-coupl...
[linux-2.6-block.git] / drivers / cpuidle / cpuidle.c
index e81cfda295a5f89fa0f009c24a8cbe1d14e0697d..bb4e827434ce4b2af71ae30b46c84918a3c4375b 100644 (file)
@@ -40,17 +40,6 @@ void disable_cpuidle(void)
        off = 1;
 }
 
-#if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT)
-static void cpuidle_kick_cpus(void)
-{
-       cpu_idle_wait();
-}
-#elif defined(CONFIG_SMP)
-# error "Arch needs cpu_idle_wait() equivalent here"
-#else /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT && !CONFIG_SMP */
-static void cpuidle_kick_cpus(void) {}
-#endif
-
 static int __cpuidle_register_device(struct cpuidle_device *dev);
 
 static inline int cpuidle_enter(struct cpuidle_device *dev,
@@ -152,15 +141,6 @@ int cpuidle_idle_call(void)
        if (!dev || !dev->enabled)
                return -EBUSY;
 
-#if 0
-       /* shows regressions, re-enable for 2.6.29 */
-       /*
-        * run any timers that can be run now, at this point
-        * before calculating the idle duration etc.
-        */
-       hrtimer_peek_ahead_timers();
-#endif
-
        /* ask the governor for the next state */
        next_state = cpuidle_curr_governor->select(drv, dev);
        if (need_resched()) {
@@ -206,7 +186,7 @@ void cpuidle_uninstall_idle_handler(void)
 {
        if (enabled_devices) {
                initialized = 0;
-               cpuidle_kick_cpus();
+               kick_all_cpus_sync();
        }
 }
 
@@ -314,6 +294,9 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
        int ret, i;
        struct cpuidle_driver *drv = cpuidle_get_driver();
 
+       if (!dev)
+               return -EINVAL;
+
        if (dev->enabled)
                return 0;
        if (!drv || !cpuidle_curr_governor)
@@ -398,8 +381,6 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
        struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
        struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
 
-       if (!dev)
-               return -EINVAL;
        if (!try_module_get(cpuidle_driver->owner))
                return -EINVAL;
 
@@ -436,6 +417,9 @@ int cpuidle_register_device(struct cpuidle_device *dev)
 {
        int ret;
 
+       if (!dev)
+               return -EINVAL;
+
        mutex_lock(&cpuidle_lock);
 
        if ((ret = __cpuidle_register_device(dev))) {