From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D94BC00144 for ; Tue, 2 Aug 2022 01:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235639AbiHBBwY (ORCPT ); Mon, 1 Aug 2022 21:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235538AbiHBBwQ (ORCPT ); Mon, 1 Aug 2022 21:52:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF69D459BA; Mon, 1 Aug 2022 18:51:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id BAB20CE19F4; Tue, 2 Aug 2022 01:51:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F04A1C433D6; Tue, 2 Aug 2022 01:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659405116; bh=Fw0Ia1iEfR3XQXeyNPpl1I2TsQCvoh0210MCyVioh0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WfJdhsjFIO2nL6Da4nDBoErNNC4vh+je7JLmNT3OVa0AjEXyhfp7TI50Ge95RU/mg XnFREnFCCtWCZH7ywC1Y2ffO+1itSx2/Tm8YPPiro5SPmNpP98dB6C8QuVASEsxxfq WjugVkpSD9dXVd3EbeDFegUAFLsZqzJxmKzSMN3JkfZ7173Qu1jV7wVcu77dcITFAL cJqHZTMRQk8v5TIhzRybezgYRhhwTaL0yPdhE0uadkOMgDni2EiYn9xEwl0sOvk7T0 Pi7GZdanYh9fdhfWi/F7beqQhrkSNIszKUDBm4vICu4bkkbtYmcaIyqGvE4mJ/tqiG kNzAKMvq92e9w== From: Miguel Ojeda To: Linus Torvalds , Greg Kroah-Hartman Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Jarkko Sakkinen , Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng Subject: [PATCH v8 07/31] locking/spinlock: introduce `__spin_lock_init` Date: Tue, 2 Aug 2022 03:49:54 +0200 Message-Id: <20220802015052.10452-8-ojeda@kernel.org> In-Reply-To: <20220802015052.10452-1-ojeda@kernel.org> References: <20220802015052.10452-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: rust-for-linux@vger.kernel.org From: Wedson Almeida Filho A Rust helper (introduced in a later patch) needs to call `spin_lock_init` with a passed key, rather than define one in place. In order to do that, this changes the `spin_lock_init` macro to call a new `__spin_lock_init` function which takes the key as an extra parameter. Co-developed-by: Alex Gaynor Signed-off-by: Alex Gaynor Signed-off-by: Wedson Almeida Filho Co-developed-by: Miguel Ojeda Signed-off-by: Miguel Ojeda --- include/linux/spinlock.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 5c0c5174155d..ad1c91884ed8 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -326,12 +326,17 @@ static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) #ifdef CONFIG_DEBUG_SPINLOCK +static inline void __spin_lock_init(spinlock_t *lock, const char *name, + struct lock_class_key *key) +{ + __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG); +} + # define spin_lock_init(lock) \ do { \ static struct lock_class_key __key; \ \ - __raw_spin_lock_init(spinlock_check(lock), \ - #lock, &__key, LD_WAIT_CONFIG); \ + __spin_lock_init(lock, #lock, &__key); \ } while (0) #else -- 2.37.1