diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2012-05-27 17:35:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-28 02:52:52 -0400 |
commit | 3732106a1a565a592966290fbcef322db9933f91 (patch) | |
tree | 928c54373e89fc110299a25c53c806d8f1e39b71 /arch/sparc | |
parent | 805918f80fb11d95e9b117a6faf5a6a7a8339e49 (diff) |
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Josip Rodin <joy@entuzijast.net>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Cc: Konrad Eisele <konrad@gaisler.com>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/process_32.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c index fe6787cc62fc..cb36e82dcd5d 100644 --- a/arch/sparc/kernel/process_32.c +++ b/arch/sparc/kernel/process_32.c | |||
@@ -65,50 +65,25 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *); | |||
65 | struct task_struct *last_task_used_math = NULL; | 65 | struct task_struct *last_task_used_math = NULL; |
66 | struct thread_info *current_set[NR_CPUS]; | 66 | struct thread_info *current_set[NR_CPUS]; |
67 | 67 | ||
68 | #ifndef CONFIG_SMP | ||
69 | |||
70 | /* | 68 | /* |
71 | * the idle loop on a Sparc... ;) | 69 | * the idle loop on a Sparc... ;) |
72 | */ | 70 | */ |
73 | void cpu_idle(void) | 71 | void cpu_idle(void) |
74 | { | 72 | { |
75 | /* endless idle loop with no priority at all */ | 73 | set_thread_flag(TIF_POLLING_NRFLAG); |
76 | for (;;) { | ||
77 | if (pm_idle) { | ||
78 | while (!need_resched()) | ||
79 | (*pm_idle)(); | ||
80 | } else { | ||
81 | while (!need_resched()) | ||
82 | cpu_relax(); | ||
83 | } | ||
84 | schedule_preempt_disabled(); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | #else | ||
89 | 74 | ||
90 | /* This is being executed in task 0 'user space'. */ | ||
91 | void cpu_idle(void) | ||
92 | { | ||
93 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
94 | /* endless idle loop with no priority at all */ | 75 | /* endless idle loop with no priority at all */ |
95 | while(1) { | 76 | for (;;) { |
96 | #ifdef CONFIG_SPARC_LEON | 77 | while (!need_resched()) { |
97 | if (pm_idle) { | 78 | if (pm_idle) |
98 | while (!need_resched()) | ||
99 | (*pm_idle)(); | 79 | (*pm_idle)(); |
100 | } else | 80 | else |
101 | #endif | ||
102 | { | ||
103 | while (!need_resched()) | ||
104 | cpu_relax(); | 81 | cpu_relax(); |
105 | } | 82 | } |
106 | schedule_preempt_disabled(); | 83 | schedule_preempt_disabled(); |
107 | } | 84 | } |
108 | } | 85 | } |
109 | 86 | ||
110 | #endif | ||
111 | |||
112 | /* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */ | 87 | /* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */ |
113 | void machine_halt(void) | 88 | void machine_halt(void) |
114 | { | 89 | { |