From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752530AbdFUWLA (ORCPT ); Wed, 21 Jun 2017 18:11:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47629 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752020AbdFUWK7 (ORCPT ); Wed, 21 Jun 2017 18:10:59 -0400 Date: Wed, 21 Jun 2017 15:10:54 -0700 From: "Paul E. McKenney" To: Arnd Bergmann Cc: Thomas Gleixner , Ingo Molnar , Sebastian Andrzej Siewior , Anna-Maria Gleixner , Boris Ostrovsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Reply-To: paulmck@linux.vnet.ibm.com References: <20170621215741.4028236-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170621215741.4028236-1-arnd@arndb.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17062122-0024-0000-0000-0000029A73DB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007268; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00877991; UDB=6.00437433; IPR=6.00658131; BA=6.00005434; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015912; XFM=3.00000015; UTC=2017-06-21 22:10:56 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062122-0025-0000-0000-000044797FB0 Message-Id: <20170621221054.GU3721@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-21_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706210368 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 21, 2017 at 11:57:28PM +0200, Arnd Bergmann wrote: > Without CONFIG_SMP, we get a harmless warning about > an unused variable: > > kernel/cpu.c: In function 'boot_cpu_state_init': > kernel/cpu.c:1778:6: error: unused variable 'cpu' [-Werror=unused-variable] > > This reworks the function to have the declaration inside > of the #ifdef. > > Fixes: faeb334286b7 ("rcu: Migrate callbacks earlier in the CPU-offline timeline") > Signed-off-by: Arnd Bergmann I simply added a __maybe_unused in 6441c656acde ("rcu: Migrate callbacks earlier in the CPU-offline timeline") in my -rcu tree. However, your approach does have the advantage of complaining if the code using that variable is removed. So, would you be OK with my folding your approach into my commit with attribution? Thanx, Paul > --- > kernel/cpu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/cpu.c b/kernel/cpu.c > index f13ad79e785d..9cd4fc35a66f 100644 > --- a/kernel/cpu.c > +++ b/kernel/cpu.c > @@ -1775,11 +1775,11 @@ void __init boot_cpu_init(void) > */ > void __init boot_cpu_state_init(void) > { > +#ifdef CONFIG_SMP > int cpu; > > - per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE; > -#ifdef CONFIG_SMP > for_each_possible_cpu(cpu) > per_cpu_ptr(&cpuhp_state, cpu)->cpu = cpu; > #endif > + per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE; > } > -- > 2.9.0 >