Skip to contentSkip to conversation

arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels

PATCH In review Otavio Salvador 4 participants 4 messages Dec 3, 2005 – Dec 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels

Disable declaration of cpu variable in default_idle function when building non-SMP kernels.

---

 arch/ppc/kernel/idle.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

applies-to: 06378a021f5873003a07f0388aa0cb6e81a32c19 156ff805b4408c6831c7840c1ed1fe3d148bc3c8

arch/ppc/kernel/idle.c +2 -0
index 821a75e..b23a979 100644
@@ -37,7 +37,9 @@
 void default_idle(void)
 {
 	void (*powersave)(void);
+#ifdef CONFIG_SMP
 	int cpu = smp_processor_id();
+#endif
 
 	powersave = ppc_md.power_save;
 

---
0.99.9k

#1 lore raw
Quoted 7 lines · Otavio Salvador

Disable declaration of cpu variable in default_idle function when building non-SMP kernels.

arch/ppc/kernel/idle.c line 45

Quoted 9 lines
arch/ppc/kernel/idle.c +2 -0
@@ -37,7 +37,9 @@
 void default_idle(void)
 {
 	void (*powersave)(void);
+#ifdef CONFIG_SMP
 	int cpu = smp_processor_id();
+#endif
 
 	powersave = ppc_md.power_save;
 

Surely this would be better?

arch/ppc/kernel/idle.c renamed from arch/ppc/kernel/idle.c~a +2 -2
@@ -37,7 +37,6 @@
 void default_idle(void)
 {
 	void (*powersave)(void);
-	int cpu = smp_processor_id();
 
 	powersave = ppc_md.power_save;
 
@@ -47,7 +46,8 @@ void default_idle(void)
 #ifdef CONFIG_SMP
 		else {
 			set_thread_flag(TIF_POLLING_NRFLAG);
-			while (!need_resched() && !cpu_is_offline(cpu))
+			while (!need_resched() &&
+					!cpu_is_offline(smp_processor_id()))
 				barrier();
 			clear_thread_flag(TIF_POLLING_NRFLAG);
 		}

_

#2 lore raw
Quoted 1 line · Andrew Morton

Surely this would be better?

Yes it would, care to give me a signed-off-by for it? :)

Paul.

#3 lore raw
In reply to Otavio Salvador

arch/ppc/kernel/idle.c line 42

Quoted 11 lines
arch/ppc/kernel/idle.c +2 -0
index 821a75e..b23a979 100644
@@ -37,7 +37,9 @@
 void default_idle(void)
 {
 	void (*powersave)(void);
+#ifdef CONFIG_SMP
 	int cpu = smp_processor_id();
+#endif

Better to just move the declaration of cpu down to the ifdef'd else block further down in the function as that's the only place it is used.