Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2288116imn; Mon, 1 Aug 2022 19:11:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vg/USBAj4zZbNFmHH77+S/6PdoMMpQJgjqkh2s45/+qpzMRrs8qHIamvfBa5Lxvl2tKjwi X-Received: by 2002:a05:6402:611:b0:43c:cb2d:76c0 with SMTP id n17-20020a056402061100b0043ccb2d76c0mr18355638edv.425.1659406271513; Mon, 01 Aug 2022 19:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659406271; cv=none; d=google.com; s=arc-20160816; b=O2DjHr2HVwUkwfivBguu6RA/9uZplcrbuuHqCCenFgcjSqhKTTsJji6V8VZC9yRkOI qsbgZ9Pxy0ixiBH/woOuAIthqD/GxYcHVuMp2tZEb1pG8P6rgSQmuQ4pQxQjX0WdHYkW NHhLObGGRpfJ29r9j8ROzsnYlYcrAiRuMOPuW0ETUKmeMrCKNADWix8GOaFA79Pc0Usm GXIvumT/+ctmLAqyl9VNrA4fYHjGAIknFSSvsSQUpTr1YeMiLiEs/DF4bpzDQ5w7x/qU J2En9TroRkHYobQAH7oCV3WUeVLavpjiVKLdn0vb1GqW2xYNZ4tIKpMWfsSBis2BsggG 83kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BCGXo9ht+qUq/5goDT66uyPjqrgKZBhkAsTZwUe+4OA=; b=YuIpcFziT8XmBp7f2+Fb26U/ToWOCdaZ8jgwMAONE9QP5TjEXyWcvBFs+v4iLk6Ihd XjaZ89hqyNQcsE4kr0eVw2p5iVdaPjNcxXk06NyiwTO2taZLbHqDCFYF8KHyZAxv9W89 SJ2s9LJg11NqTvMKDFWIXvpynv6OlBgzfTcRdnn8qEJ4xcwo3HL7Qw8g01zByINjtfA+ nnkduh/7G+HvrYlCd0IqQVMCCBI0LIdujU/vdhzei/RrJRZysN+pMEFtX3REM/brxLKu mKxyBwA5tkS2PjvFzGSSFX29pZ0PosvXzGg1pBkiCXLCm5euLgNdlb9RQwcyuNfDvyq1 8tjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WfJdhsjF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a056402328b00b0043d4a5ea78csi7043343eda.441.2022.08.01.19.10.44; Mon, 01 Aug 2022 19:11:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WfJdhsjF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235644AbiHBBwY (ORCPT + 99 others); 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 X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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