diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 3f115217c3ef..f823dd3f9480 100755 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -44,18 +44,15 @@ static atomic_t idled = ATOMIC_INIT(0); #error idled CPU mask not big enough for NR_CPUS #endif -static void cpuidle_set_idle_cpu(unsigned int cpu) +void cpuidle_set_idle_cpu(unsigned int cpu) { atomic_or(BIT(cpu), &idled); } -static void cpuidle_clear_idle_cpu(unsigned int cpu) +void cpuidle_clear_idle_cpu(unsigned int cpu) { atomic_andnot(BIT(cpu), &idled); } -#else -static inline void cpuidle_set_idle_cpu(unsigned int cpu) { } -static inline void cpuidle_clear_idle_cpu(unsigned int cpu) { } #endif int cpuidle_disabled(void) @@ -240,9 +237,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, time_start = ns_to_ktime(local_clock()); stop_critical_timings(); - cpuidle_set_idle_cpu(dev->cpu); entered_state = target_state->enter(dev, drv, index); - cpuidle_clear_idle_cpu(dev->cpu); start_critical_timings(); sched_clock_idle_wakeup_event(); diff --git a/drivers/cpuidle/lpm-levels.c b/drivers/cpuidle/lpm-levels.c index bb992dbb87b3..8a77b32c00f1 100755 --- a/drivers/cpuidle/lpm-levels.c +++ b/drivers/cpuidle/lpm-levels.c @@ -1476,7 +1476,9 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev, success = psci_enter_sleep(cpu, idx, true); sec_debug_sched_msg("-Idle(%s)", cluster->cpu->levels[idx].name); #else + cpuidle_set_idle_cpu(dev->cpu); success = psci_enter_sleep(cpu, idx, true); + cpuidle_clear_idle_cpu(dev->cpu); #endif exit: diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 113a14833ad3..4d4c1065dbfb 100755 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -277,4 +277,12 @@ static inline int cpuidle_register_governor(struct cpuidle_governor *gov) __ret ? -1 : idx; \ }) +#ifdef CONFIG_SMP +void cpuidle_set_idle_cpu(unsigned int cpu); +void cpuidle_clear_idle_cpu(unsigned int cpu); +#else +static inline void cpuidle_set_idle_cpu(unsigned int cpu) { } +static inline void cpuidle_clear_idle_cpu(unsigned int cpu) { } +#endif + #endif /* _LINUX_CPUIDLE_H */