@@ -5,6 +5,7 @@
#include <linux/cpu.h>
#include <linux/cpuidle.h>
#include <linux/cpuhotplug.h>
+#include <linux/cpu_pm.h>
#include <linux/tick.h>
#include <linux/mm.h>
#include <linux/stackprotector.h>
@@ -130,6 +131,7 @@ static void cpuidle_idle_call(void)
struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
int next_state, entered_state;
+ int ret;
/*
* Check if the idle task must be rescheduled. If it is the
@@ -174,12 +176,16 @@ static void cpuidle_idle_call(void)
/*
* Ask the cpuidle framework to choose a convenient idle state.
*/
- next_state = cpuidle_select(drv, dev);
- entered_state = call_cpuidle(drv, dev, next_state);
- /*
- * Give the governor an opportunity to reflect on the outcome
- */
- cpuidle_reflect(dev, entered_state);
+ ret = cpu_pm_enter();
+ if (!ret) {
+ next_state = cpuidle_select(drv, dev);
+ entered_state = call_cpuidle(drv, dev, next_state);
+ cpu_pm_exit();
+ /*
+ * Give the governor an opportunity to reflect on the outcome
+ */
+ cpuidle_reflect(dev, entered_state);
+ }
}
exit_idle: