Skip to contentSkip to conversation

sparc32: refactor cpu_idle()

PATCH In review Sam Ravnborg 2 participants 2 messages May 26, 2012 – May 27, 2012 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 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.

Cc Daniel Hellstrom <[email protected]>
Cc Konrad Eisele <[email protected]>
---
 arch/sparc/kernel/process_32.c |   28 ++--------------------------
 1 files changed, 2 insertions(+), 26 deletions(-)
arch/sparc/kernel/process_32.c +2 -26
index fe6787c..7d6f60e 100644
@@ -65,13 +65,13 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
 struct task_struct *last_task_used_math = NULL;
 struct thread_info *current_set[NR_CPUS];
 
-#ifndef CONFIG_SMP
-
 /*
  * the idle loop on a Sparc... ;)
  */
 void cpu_idle(void)
 {
+        set_thread_flag(TIF_POLLING_NRFLAG);
+
 	/* endless idle loop with no priority at all */
 	for (;;) {
 		if (pm_idle) {
@@ -85,30 +85,6 @@ void cpu_idle(void)
 	}
 }
 
-#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 */
-	while(1) {
-#ifdef CONFIG_SPARC_LEON
-		if (pm_idle) {
-			while (!need_resched())
-				(*pm_idle)();
-		} else
-#endif
-		{
-			while (!need_resched())
-				cpu_relax();
-		}
-		schedule_preempt_disabled();
-	}
-}
-
-#endif
-
 /* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */
 void machine_halt(void)
 {
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 18 lines · Sam Ravnborg

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.

Cc Daniel Hellstrom <[email protected]>
Cc Konrad Eisele <[email protected]>
---
 arch/sparc/kernel/process_32.c |   28 ++--------------------------
 1 files changed, 2 insertions(+), 26 deletions(-)
arch/sparc/kernel/process_32.c +0 -0
index fe6787c..7d6f60e 100644
@@ -65,13 +65,13 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
 struct task_struct *last_task_used_math = NULL;

arch/sparc/kernel/process_32.c extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *); · line 73

Quoted 10 lines
arch/sparc/kernel/process_32.c +1 -2
 struct thread_info *current_set[NR_CPUS];
 
-#ifndef CONFIG_SMP
-
 /*
  * the idle loop on a Sparc... ;)
  */
 void cpu_idle(void)
 {
+        set_thread_flag(TIF_POLLING_NRFLAG);

That seems to be 8 spaces instead of a tab there.

Signature · 1 line
     2. That which causes joy or happiness.