diff mbox

[3/5] ARM: mach-mvebu: remove redundant DT parsing and validation

Message ID 1374579164-30255-4-git-send-email-Sudeep.KarkadaNagesha@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sudeep KarkadaNagesha July 23, 2013, 11:32 a.m. UTC
From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>

arm_dt_init_cpu_maps parses the device tree, validates and sets the
cpu_possible_mask appropriately. It is unnecessary to do another DT
parse to get the number of cpus, use num_possible_cpus instead.

Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
---
 arch/arm/mach-mvebu/platsmp.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

Comments

Sudeep KarkadaNagesha Aug. 8, 2013, 2:54 p.m. UTC | #1
On 23/07/13 12:32, Sudeep KarkadaNagesha wrote:
> From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
> 
> arm_dt_init_cpu_maps parses the device tree, validates and sets the
> cpu_possible_mask appropriately. It is unnecessary to do another DT
> parse to get the number of cpus, use num_possible_cpus instead.
> 
Hi Gregory,

Does this change look fine ?
If OK, not sure if you prefer to pick up this or want me to send to
arm-soc guys.

Regards,
Sudeep

> Cc: Gregory Clement <gregory.clement@free-electrons.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
> ---
>  arch/arm/mach-mvebu/platsmp.c | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index ce81d30..2e4508a 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -87,28 +87,11 @@ static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  
>  static void __init armada_xp_smp_init_cpus(void)
>  {
> -	struct device_node *np;
> -	unsigned int i, ncores;
> +	unsigned int ncores = num_possible_cpus();
>  
> -	np = of_find_node_by_name(NULL, "cpus");
> -	if (!np)
> -		panic("No 'cpus' node found\n");
> -
> -	ncores = of_get_child_count(np);
>  	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
>  		panic("Invalid number of CPUs in DT\n");
>  
> -	/* Limit possible CPUs to defconfig */
> -	if (ncores > nr_cpu_ids) {
> -		pr_warn("SMP: %d CPUs physically present. Only %d configured.",
> -			ncores, nr_cpu_ids);
> -		pr_warn("Clipping CPU count to %d\n", nr_cpu_ids);
> -		ncores = nr_cpu_ids;
> -	}
> -
> -	for (i = 0; i < ncores; i++)
> -		set_cpu_possible(i, true);
> -
>  	set_smp_cross_call(armada_mpic_send_doorbell);
>  }
>  
>
Gregory CLEMENT Aug. 8, 2013, 3:19 p.m. UTC | #2
On 08/08/2013 16:54, Sudeep KarkadaNagesha wrote:
> On 23/07/13 12:32, Sudeep KarkadaNagesha wrote:
>> From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
>>
>> arm_dt_init_cpu_maps parses the device tree, validates and sets the
>> cpu_possible_mask appropriately. It is unnecessary to do another DT
>> parse to get the number of cpus, use num_possible_cpus instead.
>>
> Hi Gregory,
> 
> Does this change look fine ?

Yes it is a nice cleanup.

and I have just test it on an Armada XP DB board.

So you can add

my Acked-by: Gregory Clement <gregory.clement@free-electrons.com>

> If OK, not sure if you prefer to pick up this or want me to send to
> arm-soc guys.

I think it is better if we pick up this patch as it only touch a file
belonging to mvebu.

Jason,
do you agree to pick it up and then push it to in your next (and maybe
last) pull request?

Thanks,

> 
> Regards,
> Sudeep
> 
>> Cc: Gregory Clement <gregory.clement@free-electrons.com>
>> Cc: Jason Cooper <jason@lakedaemon.net>
>> Cc: Andrew Lunn <andrew@lunn.ch>
>> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
>> ---
>>  arch/arm/mach-mvebu/platsmp.c | 19 +------------------
>>  1 file changed, 1 insertion(+), 18 deletions(-)
>>
>> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
>> index ce81d30..2e4508a 100644
>> --- a/arch/arm/mach-mvebu/platsmp.c
>> +++ b/arch/arm/mach-mvebu/platsmp.c
>> @@ -87,28 +87,11 @@ static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
>>  
>>  static void __init armada_xp_smp_init_cpus(void)
>>  {
>> -	struct device_node *np;
>> -	unsigned int i, ncores;
>> +	unsigned int ncores = num_possible_cpus();
>>  
>> -	np = of_find_node_by_name(NULL, "cpus");
>> -	if (!np)
>> -		panic("No 'cpus' node found\n");
>> -
>> -	ncores = of_get_child_count(np);
>>  	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
>>  		panic("Invalid number of CPUs in DT\n");
>>  
>> -	/* Limit possible CPUs to defconfig */
>> -	if (ncores > nr_cpu_ids) {
>> -		pr_warn("SMP: %d CPUs physically present. Only %d configured.",
>> -			ncores, nr_cpu_ids);
>> -		pr_warn("Clipping CPU count to %d\n", nr_cpu_ids);
>> -		ncores = nr_cpu_ids;
>> -	}
>> -
>> -	for (i = 0; i < ncores; i++)
>> -		set_cpu_possible(i, true);
>> -
>>  	set_smp_cross_call(armada_mpic_send_doorbell);
>>  }
>>  
>>
> 
>
Jason Cooper Aug. 8, 2013, 3:50 p.m. UTC | #3
On Thu, Aug 08, 2013 at 05:19:43PM +0200, Gregory CLEMENT wrote:
> On 08/08/2013 16:54, Sudeep KarkadaNagesha wrote:
> > On 23/07/13 12:32, Sudeep KarkadaNagesha wrote:
> >> From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
> >>
> >> arm_dt_init_cpu_maps parses the device tree, validates and sets the
> >> cpu_possible_mask appropriately. It is unnecessary to do another DT
> >> parse to get the number of cpus, use num_possible_cpus instead.
> >>
> > Hi Gregory,
> > 
> > Does this change look fine ?
> 
> Yes it is a nice cleanup.
> 
> and I have just test it on an Armada XP DB board.
> 
> So you can add
> 
> my Acked-by: Gregory Clement <gregory.clement@free-electrons.com>
> 
> > If OK, not sure if you prefer to pick up this or want me to send to
> > arm-soc guys.
> 
> I think it is better if we pick up this patch as it only touch a file
> belonging to mvebu.
> 
> Jason,
> do you agree to pick it up and then push it to in your next (and maybe
> last) pull request?

Yep.

thx,

Jason.
Jason Cooper Aug. 9, 2013, 1:11 p.m. UTC | #4
On Tue, Jul 23, 2013 at 12:32:42PM +0100, Sudeep KarkadaNagesha wrote:
> From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
> 
> arm_dt_init_cpu_maps parses the device tree, validates and sets the
> cpu_possible_mask appropriately. It is unnecessary to do another DT
> parse to get the number of cpus, use num_possible_cpus instead.
> 
> Cc: Gregory Clement <gregory.clement@free-electrons.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
> ---
>  arch/arm/mach-mvebu/platsmp.c | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)

Applied to mvebu/soc with Gregory's Ack

thx,

Jason.
diff mbox

Patch

diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index ce81d30..2e4508a 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -87,28 +87,11 @@  static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 static void __init armada_xp_smp_init_cpus(void)
 {
-	struct device_node *np;
-	unsigned int i, ncores;
+	unsigned int ncores = num_possible_cpus();
 
-	np = of_find_node_by_name(NULL, "cpus");
-	if (!np)
-		panic("No 'cpus' node found\n");
-
-	ncores = of_get_child_count(np);
 	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
 		panic("Invalid number of CPUs in DT\n");
 
-	/* Limit possible CPUs to defconfig */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %d CPUs physically present. Only %d configured.",
-			ncores, nr_cpu_ids);
-		pr_warn("Clipping CPU count to %d\n", nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
 	set_smp_cross_call(armada_mpic_send_doorbell);
 }