2 * poll_state.c - Polling idle state
4 * This file is released under the GPLv2.
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
)
15 if (!current_set_polling_and_test()) {
16 while (!need_resched())
19 current_clr_polling();
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
);