From patchwork Thu Sep 20 11:28:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 10607529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB4081508 for ; Thu, 20 Sep 2018 11:28:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA2562D09B for ; Thu, 20 Sep 2018 11:28:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE81C2D0A8; Thu, 20 Sep 2018 11:28:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7239F2D09B for ; Thu, 20 Sep 2018 11:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732173AbeITRL4 (ORCPT ); Thu, 20 Sep 2018 13:11:56 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:50992 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727986AbeITRL4 (ORCPT ); Thu, 20 Sep 2018 13:11:56 -0400 Received: from 91-156-4-241.elisa-laajakaista.fi ([91.156.4.241] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.91) (envelope-from ) id 1g2x8f-0004SQ-1X; Thu, 20 Sep 2018 14:28:53 +0300 From: Luca Coelho To: backports@vger.kernel.org Cc: Luca Coelho Date: Thu, 20 Sep 2018 14:28:36 +0300 Message-Id: <20180920112842.27198-9-luca@coelho.fi> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180920112842.27198-1-luca@coelho.fi> References: <20180920112842.27198-1-luca@coelho.fi> Subject: [PATCH 08/14] backport: prevent unused subclass variable warning in < 3.18 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luca Coelho In kernels earlier than 3.18, the raw_spin_lock defininition when CONFIG_DEBUG_LOCK_ALLOC is not enabled, was dropping one of the parameters, which caused a few "unused variable" warnings at places where this argument was only used in the call to raw_spin_lock_nested(). Take the latest definition which evaluates the argument to avoid compiler warnings. Signed-off-by: Luca Coelho --- backport/backport-include/linux/spinlock.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backport/backport-include/linux/spinlock.h b/backport/backport-include/linux/spinlock.h index 07daa358e25d..a46f6e33b241 100644 --- a/backport/backport-include/linux/spinlock.h +++ b/backport/backport-include/linux/spinlock.h @@ -2,6 +2,21 @@ #define __BACKPORT_SPINLOCK_H #include_next +#if LINUX_VERSION_IS_LESS(3,18,0) +#ifndef CONFIG_DEBUG_LOCK_ALLOC +#undef raw_spin_lock_nested +/* + * Always evaluate the 'subclass' argument to avoid that the compiler + * warns about set-but-not-used variables when building with + * CONFIG_DEBUG_LOCK_ALLOC=n and with W=1. + */ +# define raw_spin_lock_nested(lock, subclass) \ + _raw_spin_lock(((void)(subclass), (lock))) +# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) +#endif +#endif /* LINUX_VERSION_IS_LESS(3,18,0) */ + + #if LINUX_VERSION_IS_LESS(4,16,0) int alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask, size_t max_size, unsigned int cpu_mult,