Commit 3732106a authored by Sam Ravnborg's avatar Sam Ravnborg Committed by David S. Miller

sparc32: refactor cpu_idle()

With the removal of sun4c we can use the same cpu_idle()
implementation on UP and SMP.
This also fix it so we use the same version independent on LEON
enabled or not.

V2: Fixed whitespace issue pointed out by Josip Rodin.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Cc: Josip Rodin <joy@entuzijast.net>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Cc: Konrad Eisele <konrad@gaisler.com>
parent 805918f8
...@@ -65,50 +65,25 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *); ...@@ -65,50 +65,25 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
struct task_struct *last_task_used_math = NULL; struct task_struct *last_task_used_math = NULL;
struct thread_info *current_set[NR_CPUS]; struct thread_info *current_set[NR_CPUS];
#ifndef CONFIG_SMP
/* /*
* the idle loop on a Sparc... ;) * the idle loop on a Sparc... ;)
*/ */
void cpu_idle(void) void cpu_idle(void)
{ {
/* endless idle loop with no priority at all */ set_thread_flag(TIF_POLLING_NRFLAG);
for (;;) {
if (pm_idle) {
while (!need_resched())
(*pm_idle)();
} else {
while (!need_resched())
cpu_relax();
}
schedule_preempt_disabled();
}
}
#else
/* This is being executed in task 0 'user space'. */
void cpu_idle(void)
{
set_thread_flag(TIF_POLLING_NRFLAG);
/* endless idle loop with no priority at all */ /* endless idle loop with no priority at all */
while(1) { for (;;) {
#ifdef CONFIG_SPARC_LEON while (!need_resched()) {
if (pm_idle) { if (pm_idle)
while (!need_resched())
(*pm_idle)(); (*pm_idle)();
} else else
#endif
{
while (!need_resched())
cpu_relax(); cpu_relax();
} }
schedule_preempt_disabled(); schedule_preempt_disabled();
} }
} }
#endif
/* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */ /* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */
void machine_halt(void) void machine_halt(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment