Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpuidle: Rearrange s2idle-specific idle state entry code

Implement call_cpuidle_s2idle() in analogy with call_cpuidle()
for the s2idle-specific idle state entry and invoke it from
cpuidle_idle_call() to make the s2idle-specific idle entry code
path look more similar to the "regular" idle entry one.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Chen Yu <yu.c.chen@intel.com>

+14 -7
+3 -3
drivers/cpuidle/cpuidle.c
··· 13 13 #include <linux/mutex.h> 14 14 #include <linux/sched.h> 15 15 #include <linux/sched/clock.h> 16 - #include <linux/sched/idle.h> 17 16 #include <linux/notifier.h> 18 17 #include <linux/pm_qos.h> 19 18 #include <linux/cpu.h> ··· 186 187 * be frozen safely. 187 188 */ 188 189 index = find_deepest_state(drv, dev, U64_MAX, 0, true); 189 - if (index > 0 && !current_clr_polling_and_test()) 190 + if (index > 0) { 190 191 enter_s2idle_proper(drv, dev, index); 191 - 192 + local_irq_enable(); 193 + } 192 194 return index; 193 195 } 194 196 #endif /* CONFIG_SUSPEND */
+11 -4
kernel/sched/idle.c
··· 96 96 } 97 97 } 98 98 99 + static int call_cpuidle_s2idle(struct cpuidle_driver *drv, 100 + struct cpuidle_device *dev) 101 + { 102 + if (current_clr_polling_and_test()) 103 + return -EBUSY; 104 + 105 + return cpuidle_enter_s2idle(drv, dev); 106 + } 107 + 99 108 static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev, 100 109 int next_state) 101 110 { ··· 180 171 if (idle_should_enter_s2idle()) { 181 172 rcu_idle_enter(); 182 173 183 - entered_state = cpuidle_enter_s2idle(drv, dev); 184 - if (entered_state > 0) { 185 - local_irq_enable(); 174 + entered_state = call_cpuidle_s2idle(drv, dev); 175 + if (entered_state > 0) 186 176 goto exit_idle; 187 - } 188 177 189 178 rcu_idle_exit(); 190 179