Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / drivers / cpuidle / poll_state.c
blob7416b16287de040190d28db95f11cc76c4650b87
1 /*
2 * poll_state.c - Polling idle state
4 * This file is released under the GPLv2.
5 */
7 #include <linux/cpuidle.h>
8 #include <linux/sched.h>
9 #include <linux/sched/idle.h>
11 static int __cpuidle poll_idle(struct cpuidle_device *dev,
12 struct cpuidle_driver *drv, int index)
14 local_irq_enable();
15 if (!current_set_polling_and_test()) {
16 while (!need_resched())
17 cpu_relax();
19 current_clr_polling();
21 return index;
24 void cpuidle_poll_state_init(struct cpuidle_driver *drv)
26 struct cpuidle_state *state = &drv->states[0];
28 snprintf(state->name, CPUIDLE_NAME_LEN, "POLL");
29 snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
30 state->exit_latency = 0;
31 state->target_residency = 0;
32 state->power_usage = -1;
33 state->enter = poll_idle;
34 state->disabled = false;
35 state->flags = CPUIDLE_FLAG_POLLING;
37 EXPORT_SYMBOL_GPL(cpuidle_poll_state_init);