diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2011-08-01 17:25:06 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2012-01-20 18:55:05 -0500 |
commit | 4fa20439a80c008d33f2865b0db94dcb5da467e2 (patch) | |
tree | b11eb45155ffe12131716e7c4c8742276187fdf9 /arch/arm/kernel/process.c | |
parent | 3c0b2cef913c8f92b15a5a1fe7b611836f7f80bf (diff) | |
download | op-kernel-dev-4fa20439a80c008d33f2865b0db94dcb5da467e2.zip op-kernel-dev-4fa20439a80c008d33f2865b0db94dcb5da467e2.tar.gz |
ARM: clean up idle handlers
Let's factor out the need_resched() check instead of having it duplicated
in every pm_idle implementations to avoid inconsistencies (omap2_pm_idle
is missing it already).
The forceful re-enablement of IRQs after pm_idle has returned can go.
The warning certainly doesn't trigger for existing users.
To get rid of the pm_idle calling convention oddity, let's introduce
arm_pm_idle() allowing for the local_irq_enable() to be factored out
from SOC specific implementations. The default pm_idle function becomes
a wrapper for arm_pm_idle and it takes care of enabling IRQs closer to
where they are initially disabled.
And finally move the comment explaining the reason for that turning off
of IRQs to a more proper location.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-and-tested-by: Jamie Iles <jamie@jamieiles.com>
Diffstat (limited to 'arch/arm/kernel/process.c')
-rw-r--r-- | arch/arm/kernel/process.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 971d65c..ba9e7ef 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -181,12 +181,16 @@ void cpu_idle_wait(void) EXPORT_SYMBOL_GPL(cpu_idle_wait); /* - * This is our default idle handler. We need to disable - * interrupts here to ensure we don't miss a wakeup call. + * This is our default idle handler. */ + +void (*arm_pm_idle)(void); + static void default_idle(void) { - if (!need_resched()) + if (arm_pm_idle) + arm_pm_idle(); + else arch_idle(); local_irq_enable(); } @@ -215,6 +219,10 @@ void cpu_idle(void) cpu_die(); #endif + /* + * We need to disable interrupts here + * to ensure we don't miss a wakeup call. + */ local_irq_disable(); #ifdef CONFIG_PL310_ERRATA_769419 wmb(); @@ -222,19 +230,18 @@ void cpu_idle(void) if (hlt_counter) { local_irq_enable(); cpu_relax(); - } else { + } else if (!need_resched()) { stop_critical_timings(); if (cpuidle_idle_call()) pm_idle(); start_critical_timings(); /* - * This will eventually be removed - pm_idle - * functions should always return with IRQs - * enabled. + * pm_idle functions must always + * return with IRQs enabled. */ WARN_ON(irqs_disabled()); + } else local_irq_enable(); - } } leds_event(led_idle_end); rcu_idle_exit(); |