diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-06-19 09:40:51 +0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-06-23 12:30:17 +0400 |
commit | 2e046b9487dcc60707cac77fb8f744ec830209cd (patch) | |
tree | 9031ab1f8c1d2037b6be97e9378983a89267fd54 /arch/sh/kernel/idle.c | |
parent | d888a4c76c51092993643f8992bf55b3c28da483 (diff) | |
download | linux-2e046b9487dcc60707cac77fb8f744ec830209cd.tar.xz |
sh: Provide cpu_idle_wait() to fix up cpuidle/SMP build.
Crib the x86 cpu_idle_wait() implementation and shove it in with the
idle code, subsequently enabling ARCH_HAS_CPU_IDLE_WAIT.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/idle.c')
-rw-r--r-- | arch/sh/kernel/idle.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c index f35ed0348850..27ff2dc093c7 100644 --- a/arch/sh/kernel/idle.c +++ b/arch/sh/kernel/idle.c @@ -1,7 +1,7 @@ /* * The idle loop for all SuperH platforms. * - * Copyright (C) 2002 - 2008 Paul Mundt + * Copyright (C) 2002 - 2009 Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -15,6 +15,7 @@ #include <linux/preempt.h> #include <linux/thread_info.h> #include <linux/irqflags.h> +#include <linux/smp.h> #include <asm/pgalloc.h> #include <asm/system.h> #include <asm/atomic.h> @@ -79,3 +80,23 @@ void cpu_idle(void) check_pgt_cache(); } } + +static void do_nothing(void *unused) +{ +} + +/* + * cpu_idle_wait - Used to ensure that all the CPUs discard old value of + * pm_idle and update to new pm_idle value. Required while changing pm_idle + * handler on SMP systems. + * + * Caller must have changed pm_idle to the new value before the call. Old + * pm_idle value will not be used by any CPU after the return of this function. + */ +void cpu_idle_wait(void) +{ + smp_mb(); + /* kick all the CPUs so that they exit out of pm_idle */ + smp_call_function(do_nothing, NULL, 1); +} +EXPORT_SYMBOL_GPL(cpu_idle_wait); |