summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-29 03:14:37 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-30 03:06:33 +0200
commit1b39e3f813b4685c7a30ae964d5529a1b0e3a286 (patch)
treec99c7dfdb062f77af7076c398358dadfcdffa9ca
parent34c2f65b718d44ea7d7b3cc10777f410677455ce (diff)
downloadop-kernel-dev-1b39e3f813b4685c7a30ae964d5529a1b0e3a286.zip
op-kernel-dev-1b39e3f813b4685c7a30ae964d5529a1b0e3a286.tar.gz
cpuidle: Make drivers initialize polling state
Make the drivers that want to include the polling state into their states table initialize it explicitly and drop the initialization of it (which in fact is conditional, but that is not obvious from the code) from the core. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--drivers/acpi/processor_idle.c9
-rw-r--r--drivers/cpuidle/driver.c2
-rw-r--r--drivers/cpuidle/poll_state.c3
-rw-r--r--drivers/idle/intel_idle.c1
-rw-r--r--include/linux/cpuidle.h4
5 files changed, 13 insertions, 6 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 39a01ea..df38e81 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -842,7 +842,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
static int acpi_processor_setup_cstates(struct acpi_processor *pr)
{
- int i, count = ACPI_IDLE_STATE_START;
+ int i, count;
struct acpi_processor_cx *cx;
struct cpuidle_state *state;
struct cpuidle_driver *drv = &acpi_idle_driver;
@@ -850,6 +850,13 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
if (max_cstate == 0)
max_cstate = 1;
+ if (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX)) {
+ cpuidle_poll_state_init(drv);
+ count = 1;
+ } else {
+ count = 0;
+ }
+
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
cx = &pr->power.states[i];
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 6f694c8..dc32f34 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -216,8 +216,6 @@ static int __cpuidle_register_driver(struct cpuidle_driver *drv)
on_each_cpu_mask(drv->cpumask, cpuidle_setup_broadcast_timer,
(void *)1, 1);
- poll_idle_init(drv);
-
return 0;
}
diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c
index 0db4f72..7416b16 100644
--- a/drivers/cpuidle/poll_state.c
+++ b/drivers/cpuidle/poll_state.c
@@ -21,7 +21,7 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev,
return index;
}
-void poll_idle_init(struct cpuidle_driver *drv)
+void cpuidle_poll_state_init(struct cpuidle_driver *drv)
{
struct cpuidle_state *state = &drv->states[0];
@@ -34,3 +34,4 @@ void poll_idle_init(struct cpuidle_driver *drv)
state->disabled = false;
state->flags = CPUIDLE_FLAG_POLLING;
}
+EXPORT_SYMBOL_GPL(cpuidle_poll_state_init);
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index c2ae819..7bf8739e 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1331,6 +1331,7 @@ static void __init intel_idle_cpuidle_driver_init(void)
intel_idle_state_table_update();
+ cpuidle_poll_state_init(drv);
drv->state_count = 1;
for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) {
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 561bc53..5baacd3 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -226,9 +226,9 @@ static inline void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev,
#endif
#ifdef CONFIG_ARCH_HAS_CPU_RELAX
-void poll_idle_init(struct cpuidle_driver *drv);
+void cpuidle_poll_state_init(struct cpuidle_driver *drv);
#else
-static void poll_idle_init(struct cpuidle_driver *drv) {}
+static inline void cpuidle_poll_state_init(struct cpuidle_driver *drv) {}
#endif
/******************************
OpenPOWER on IntegriCloud