diff mbox

powerpc: kernel: remove useless code which related with 'max_cpus'

Message ID 51ECCA10.7010709@asianux.com (mailing list archive)
State Superseded
Headers show

Commit Message

Chen Gang July 22, 2013, 5:58 a.m. UTC
Since not need 'max_cpus' after the related commit, the related code
are useless too, need be removed.

The related commit:

  c1aa687 powerpc: Clean up obsolete code relating to decrementer and timebase

The related warning:

  arch/powerpc/kernel/smp.c:323:43: warning: parameter ‘max_cpus’ set but not used [-Wunused-but-set-parameter]

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/powerpc/kernel/smp.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

Comments

Srivatsa S. Bhat July 22, 2013, 6:18 a.m. UTC | #1
On 07/22/2013 11:28 AM, Chen Gang wrote:
> Since not need 'max_cpus' after the related commit, the related code
> are useless too, need be removed.
> 
> The related commit:
> 
>   c1aa687 powerpc: Clean up obsolete code relating to decrementer and timebase
> 
> The related warning:
> 
>   arch/powerpc/kernel/smp.c:323:43: warning: parameter ‘max_cpus’ set but not used [-Wunused-but-set-parameter]
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/powerpc/kernel/smp.c |    8 --------
>  1 files changed, 0 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 38b0ba6..8c2bae4 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -345,14 +345,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
> 
>  	cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
>  	cpumask_set_cpu(boot_cpuid, cpu_core_mask(boot_cpuid));
> -
> -	if (smp_ops)
> -		if (smp_ops->probe)
> -			max_cpus = smp_ops->probe();

No, you can't just remove the call to ->probe(). Its essential.
For example, one such ->probe() routine, xics_smp_probe() does some
pretty important stuff, such as populating the ->cause_ipi function
pointer etc, see below:

143 int __init xics_smp_probe(void)
144 {
145         /* Setup cause_ipi callback  based on which ICP is used */
146         smp_ops->cause_ipi = icp_ops->cause_ipi;
147 
148         /* Register all the IPIs */
149         xics_request_ipi();
150 
151         return cpumask_weight(cpu_possible_mask);
152 }

> -		else
> -			max_cpus = NR_CPUS;
> -	else
> -		max_cpus = 1;
>  }
>

Yes, max_cpus is unused, but you have to be careful while removing
code.
Regards,
Srivatsa S. Bhat
Chen Gang July 22, 2013, 6:27 a.m. UTC | #2
On 07/22/2013 02:18 PM, Srivatsa S. Bhat wrote:
> On 07/22/2013 11:28 AM, Chen Gang wrote:
>> > Since not need 'max_cpus' after the related commit, the related code
>> > are useless too, need be removed.
>> > 
>> > The related commit:
>> > 
>> >   c1aa687 powerpc: Clean up obsolete code relating to decrementer and timebase
>> > 
>> > The related warning:
>> > 
>> >   arch/powerpc/kernel/smp.c:323:43: warning: parameter �max_cpus� set but not used [-Wunused-but-set-parameter]
>> > 
>> > Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> > ---
>> >  arch/powerpc/kernel/smp.c |    8 --------
>> >  1 files changed, 0 insertions(+), 8 deletions(-)
>> > 
>> > diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>> > index 38b0ba6..8c2bae4 100644
>> > --- a/arch/powerpc/kernel/smp.c
>> > +++ b/arch/powerpc/kernel/smp.c
>> > @@ -345,14 +345,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>> > 
>> >  	cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
>> >  	cpumask_set_cpu(boot_cpuid, cpu_core_mask(boot_cpuid));
>> > -
>> > -	if (smp_ops)
>> > -		if (smp_ops->probe)
>> > -			max_cpus = smp_ops->probe();
> No, you can't just remove the call to ->probe(). Its essential.
> For example, one such ->probe() routine, xics_smp_probe() does some
> pretty important stuff, such as populating the ->cause_ipi function
> pointer etc, see below:
> 
> 143 int __init xics_smp_probe(void)
> 144 {
> 145         /* Setup cause_ipi callback  based on which ICP is used */
> 146         smp_ops->cause_ipi = icp_ops->cause_ipi;
> 147 
> 148         /* Register all the IPIs */
> 149         xics_request_ipi();
> 150 
> 151         return cpumask_weight(cpu_possible_mask);
> 152 }
> 

OK, thanks.

>> > -		else
>> > -			max_cpus = NR_CPUS;
>> > -	else
>> > -		max_cpus = 1;
>> >  }
>> >
> Yes, max_cpus is unused, but you have to be careful while removing
> code.

I should send patch v2, soon.  :-)

> Regards,
> Srivatsa S. Bhat
> 
> 
> 

Thanks.
diff mbox

Patch

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 38b0ba6..8c2bae4 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -345,14 +345,6 @@  void __init smp_prepare_cpus(unsigned int max_cpus)
 
 	cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
 	cpumask_set_cpu(boot_cpuid, cpu_core_mask(boot_cpuid));
-
-	if (smp_ops)
-		if (smp_ops->probe)
-			max_cpus = smp_ops->probe();
-		else
-			max_cpus = NR_CPUS;
-	else
-		max_cpus = 1;
 }
 
 void smp_prepare_boot_cpu(void)