linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels
@ 2005-12-03 18:34 Otavio Salvador
  2005-12-03 18:46 ` Andrew Morton
  2005-12-03 19:00 ` Nathan Lynch
  0 siblings, 2 replies; 4+ messages in thread
From: Otavio Salvador @ 2005-12-03 18:34 UTC (permalink / raw)
  To: linuxppc-dev, akpm; +Cc: Otavio Salvador

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

Signed-off-by: Otavio Salvador <otavio@debian.org>


---

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

applies-to: 06378a021f5873003a07f0388aa0cb6e81a32c19
156ff805b4408c6831c7840c1ed1fe3d148bc3c8
diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
index 821a75e..b23a979 100644
--- a/arch/ppc/kernel/idle.c
+++ b/arch/ppc/kernel/idle.c
@@ -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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels
  2005-12-03 18:34 [PATCH] arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels Otavio Salvador
@ 2005-12-03 18:46 ` Andrew Morton
  2005-12-05  4:12   ` Paul Mackerras
  2005-12-03 19:00 ` Nathan Lynch
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2005-12-03 18:46 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: linuxppc-dev

Otavio Salvador <otavio@debian.org> wrote:
>
> Disable declaration of cpu variable in default_idle function when
> building non-SMP kernels.
> 
> --- a/arch/ppc/kernel/idle.c
> +++ b/arch/ppc/kernel/idle.c
> @@ -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?

--- devel/arch/ppc/kernel/idle.c~a	2005-12-03 10:45:37.000000000 -0800
+++ devel-akpm/arch/ppc/kernel/idle.c	2005-12-03 10:46:03.000000000 -0800
@@ -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);
 		}
_

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels
  2005-12-03 18:34 [PATCH] arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels Otavio Salvador
  2005-12-03 18:46 ` Andrew Morton
@ 2005-12-03 19:00 ` Nathan Lynch
  1 sibling, 0 replies; 4+ messages in thread
From: Nathan Lynch @ 2005-12-03 19:00 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: akpm, linuxppc-dev

> diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
> index 821a75e..b23a979 100644
> --- a/arch/ppc/kernel/idle.c
> +++ b/arch/ppc/kernel/idle.c
> @@ -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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels
  2005-12-03 18:46 ` Andrew Morton
@ 2005-12-05  4:12   ` Paul Mackerras
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2005-12-05  4:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-dev, Otavio Salvador

Andrew Morton writes:

> Surely this would be better?

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

Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-05  4:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-03 18:34 [PATCH] arch/ppc/kernel/idle.c: don't declare cpu variable in non-SMP kernels Otavio Salvador
2005-12-03 18:46 ` Andrew Morton
2005-12-05  4:12   ` Paul Mackerras
2005-12-03 19:00 ` Nathan Lynch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).