linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/85xx: Fix SMP compile error and allow NULL for smp_ops
@ 2009-09-08 19:21 Kumar Gala
  2009-09-08 21:31 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar Gala @ 2009-09-08 19:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

The following commit introduced a compile error since it removed
the implementation of smp_85xx_basic_setup:

commit 77c0a700c1c292edafa11c1e52821ce4636f81b0
Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date:   Fri Aug 28 14:25:04 2009 +1000

    powerpc: Properly start decrementer on BookE secondary CPUs

Make it so that smp_ops probe() and setup_cpu() can be set to NULL.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/kernel/smp.c         |   10 +++++++---
 arch/powerpc/platforms/85xx/smp.c |   13 +++----------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 96f107c..d387b39 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -269,7 +269,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 	cpu_callin_map[boot_cpuid] = 1;
 
 	if (smp_ops)
-		max_cpus = smp_ops->probe();
+		if (smp_ops->probe)
+			max_cpus = smp_ops->probe();
+		else
+			max_cpus = NR_CPUS;
 	else
 		max_cpus = 1;
  
@@ -493,7 +496,8 @@ int __devinit start_secondary(void *unused)
 	preempt_disable();
 	cpu_callin_map[cpu] = 1;
 
-	smp_ops->setup_cpu(cpu);
+	if (smp_ops->setup_cpu)
+		smp_ops->setup_cpu(cpu);
 	if (smp_ops->take_timebase)
 		smp_ops->take_timebase();
 
@@ -556,7 +560,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
 	old_mask = current->cpus_allowed;
 	set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid));
 	
-	if (smp_ops)
+	if (smp_ops && smp_ops->setup_cpu)
 		smp_ops->setup_cpu(boot_cpuid);
 
 	set_cpus_allowed(current, old_mask);
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 94f901d..d3cf357 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -85,28 +85,21 @@ smp_85xx_setup_cpu(int cpu_nr)
 }
 
 struct smp_ops_t smp_85xx_ops = {
+	.message_pass = NULL,
+	.probe = NULL,
 	.kick_cpu = smp_85xx_kick_cpu,
+	.setup_cpu = NULL,
 };
 
-static int __init smp_dummy_probe(void)
-{
-	return NR_CPUS;
-}
-
 void __init mpc85xx_smp_init(void)
 {
 	struct device_node *np;
 
-	smp_85xx_ops.message_pass = NULL;
-
 	np = of_find_node_by_type(NULL, "open-pic");
 	if (np) {
 		smp_85xx_ops.probe = smp_mpic_probe;
 		smp_85xx_ops.setup_cpu = smp_85xx_setup_cpu;
 		smp_85xx_ops.message_pass = smp_mpic_message_pass;
-	} else {
-		smp_85xx_ops.probe = smp_dummy_probe;
-		smp_85xx_ops.setup_cpu = smp_85xx_basic_setup;
 	}
 
 	if (cpu_has_feature(CPU_FTR_DBELL))
-- 
1.6.0.6

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

* Re: [PATCH] powerpc/85xx: Fix SMP compile error and allow NULL for smp_ops
  2009-09-08 19:21 [PATCH] powerpc/85xx: Fix SMP compile error and allow NULL for smp_ops Kumar Gala
@ 2009-09-08 21:31 ` Benjamin Herrenschmidt
  2009-09-09  3:08   ` Kumar Gala
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2009-09-08 21:31 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

On Tue, 2009-09-08 at 14:21 -0500, Kumar Gala wrote:

>  
>  struct smp_ops_t smp_85xx_ops = {
> +	.message_pass = NULL,
> +	.probe = NULL,
>  	.kick_cpu = smp_85xx_kick_cpu,
> +	.setup_cpu = NULL,
>  };

Why explicitely setting those to NULL ?

Cheers,
Ben.

> -static int __init smp_dummy_probe(void)
> -{
> -	return NR_CPUS;
> -}
> -
>  void __init mpc85xx_smp_init(void)
>  {
>  	struct device_node *np;
>  
> -	smp_85xx_ops.message_pass = NULL;
> -
>  	np = of_find_node_by_type(NULL, "open-pic");
>  	if (np) {
>  		smp_85xx_ops.probe = smp_mpic_probe;
>  		smp_85xx_ops.setup_cpu = smp_85xx_setup_cpu;
>  		smp_85xx_ops.message_pass = smp_mpic_message_pass;
> -	} else {
> -		smp_85xx_ops.probe = smp_dummy_probe;
> -		smp_85xx_ops.setup_cpu = smp_85xx_basic_setup;
>  	}
>  
>  	if (cpu_has_feature(CPU_FTR_DBELL))

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

* Re: [PATCH] powerpc/85xx: Fix SMP compile error and allow NULL for smp_ops
  2009-09-08 21:31 ` Benjamin Herrenschmidt
@ 2009-09-09  3:08   ` Kumar Gala
  0 siblings, 0 replies; 3+ messages in thread
From: Kumar Gala @ 2009-09-09  3:08 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev


On Sep 8, 2009, at 4:31 PM, Benjamin Herrenschmidt wrote:

> On Tue, 2009-09-08 at 14:21 -0500, Kumar Gala wrote:
>
>>
>> struct smp_ops_t smp_85xx_ops = {
>> +	.message_pass = NULL,
>> +	.probe = NULL,
>> 	.kick_cpu = smp_85xx_kick_cpu,
>> +	.setup_cpu = NULL,
>> };
>
> Why explicitely setting those to NULL ?
>
> Cheers,
> Ben.

couldn't remember if we get NULL for initialized structs or not.

- k

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

end of thread, other threads:[~2009-09-09  3:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-08 19:21 [PATCH] powerpc/85xx: Fix SMP compile error and allow NULL for smp_ops Kumar Gala
2009-09-08 21:31 ` Benjamin Herrenschmidt
2009-09-09  3:08   ` Kumar Gala

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).