From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753000AbbJMUbE (ORCPT ); Tue, 13 Oct 2015 16:31:04 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:61800 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752668AbbJMUbD (ORCPT ); Tue, 13 Oct 2015 16:31:03 -0400 From: Arnd Bergmann To: Ingo Molnar Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Brown , Liam Girdwood , akpm@linux-foundation.org Subject: [PATCH] mutex: make mutex_lock_nested an inline function Date: Tue, 13 Oct 2015 22:30:08 +0200 Message-ID: <11282238.AHmyWliPRj@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:cIUpcfz3wO7cG8QihDXkN1GIOx5+iKxX75QxHvpwww+lZh1t+BP FCNR1vsRtal8hG9lMxDWchHf/WnnjeAMHMK2F4153DTKBjWg7koJgcoCHPSOx8AWFmGBkrB LPkIgNLaYV5wYzVlC4kaerVG2u4L2tPAQFaQUCTnyIT+NhFCm0Ktio/JFsjYnIwlsVl/pTL 3QAohpaYM5OZFZCEevYWw== X-UI-Out-Filterresults: notjunk:1;V01:K0:lDI+Xd3Qlv8=:Kli3VUoR0TaLGoKpI7EZPp FF3piYWx5Z10mhhlUMKrqIsIZb/i5M2FHyB9M4AVCVg3eg3bbAvEcsu+ysZptljncv8b7i9II aPHoibI+rI4p2N7tcDvtXtrYYPiOi4ClBgi2PNs/38KnIyuwtdKdoVEUFx8MCz1VMfh1RCndU J9g4rFj28yvO5vdCxMGXrf0LdzfPCUQH/SxgN41Io41+wVMIX9CLmOcGV5AAKYx3muuFqh2l8 Bm6YiwXn57JMx1CaMe5SvaLqzNiW/ApBihNqOfmZdQDctkXW4XtjVBoHPk8I7ARWZ1BRtTPT7 1N88baC/pEoguTBDAuCUM1d5AO3rphUSINtyR7OhGK/JBU/XyoDX3H/OkID4e1TLh+iUqM7rB x/bP6n1ANEDTNTo/UQYIeUQ169CkA5D5dHZIUHoyGA89ld7+eWnYDCEuRuPKUjiUstAKMzzp9 2SRkqX/bY1yEfAdXBmeQNg7etxEJW7GMAXq5T1wPmyYQ6A5CC4f8j9xmYTbh18iKTt2dwnuTh uHd7W1z92XSRNj3aojezkZnDTR2qeD2Nm+Z1po1zKIzjl4CIBsqH5lPD7ByxW0MLhyvX+QoTA pEuUHeDqqWJ5BimzGoz1Pkfsx8LfN05f5jiUbrM74lukPWBPMMoB15sk+mAiPdgr1Swhzuqxs vsM8QXp8xjM5LkcKi8DLPLpp0SD5R6tCG1WtPV0wmOLya2dNZoun6V3w6KR+TYrbRSaZMnaET iaNAH2YeZeo8yxhD Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The second argument of the mutex_lock_nested() helper is only evaluated if CONFIG_DEBUG_LOCK_ALLOC is set. Otherwise we get this build warning for the new regulator_lock_supply function: drivers/regulator/core.c: In function 'regulator_lock_supply': drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable] To avoid the warning, this patch changes the definition of mutex_lock_nested() to be static inline function rather than a macro, which tells gcc that the variable is potentially used. Signed-off-by: Arnd Bergmann Fixes: 9f01cd4a915 ("regulator: core: introduce function to lock regulators and its supplies") --- Second try, this time fixing the root of the problem rather than the code that triggered it, as suggested by Mark Brown. I guess this means the fix should now probably go through Ingo's sched-locking branch or through Andrew's mm patches. The warning currently only shows up in Linux-next because of Mark's regulator branch that is destined for 4.4, so it's not needed for 4.3 but also harmless. diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 2cb7531e7d7a..9494dafd7a9c 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -158,7 +158,10 @@ extern void mutex_lock(struct mutex *lock); extern int __must_check mutex_lock_interruptible(struct mutex *lock); extern int __must_check mutex_lock_killable(struct mutex *lock); -# define mutex_lock_nested(lock, subclass) mutex_lock(lock) +static inline void mutex_lock_nested(struct mutex *lock, unsigned int subclass) +{ + return mutex_lock(lock); +} # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) # define mutex_lock_killable_nested(lock, subclass) mutex_lock_killable(lock) # define mutex_lock_nest_lock(lock, nest_lock) mutex_lock(lock)