Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2284325imn; Mon, 1 Aug 2022 19:00:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tmnlRo8RRzWTxsiHVvAxjtiF2faQ3HgSO5eiPNGw4d15SuO0ge/51bwkXS8VN9+d89Azgk X-Received: by 2002:a17:907:7ba2:b0:72b:57da:a76e with SMTP id ne34-20020a1709077ba200b0072b57daa76emr14636788ejc.210.1659405612916; Mon, 01 Aug 2022 19:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659405612; cv=none; d=google.com; s=arc-20160816; b=DX89BaxglSTBBIcDlORllrDfD+XPphw+8ET0NQBPV+1H0iJNU+XSbqz5/47+j3SZH9 Xpv6yEAe/h51YTM35yQJDFGs40rnlB5y5daXPCjhdvzad6mKgiGTvLOZq/RDvPvQi9p7 925d/FiiAn37SQI+5tp5kzT6qCPc7mcw694tZbbqzcLHX/vMd23uNnYQ6DOOlTGcGhtH cknChZ+05MZqcjs+/j7FNQ6c33mU0gWt3dqhVeidQyTD+ePgma2JseAJl/Xz41j7YJjZ 38nUgf4OirjRkcwSlkZQjcY+WYAMLJxx8Pz8mI9KsFm8V7urCZP2UIqhdfaGk6oZ74n1 z4Eg== 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=w7WmRRW1/gTpf/GACx0BE+wUHynKonHfubzICm3Wf4M=; b=zO02/E52Yb+byw5W/POIqDpXs+dtsnGo4v6r0ePfwBSoUmITJKQsRhEd4NuCm6i9gQ MKgh+2b4MjO2d/DG88jNg4YtxUl4QeqdthsRrigHiALi2WXGYmZns5BLXzorUnr7Rwwl uBjW5u0y4yse6d1GnEXfOJ521NTR/utMzy+JAkiXbEk5CzWc9QyHQFSVUB3VbT+Hvoap HwmTZ8EaJWfAcVCJL3D6TJC7AzifHw2Qvx2mmlPXV/BWs+mIFclXIu1mqW9FzgsD9Mq0 4ppa72/tJkOWDAjIKheDmQn5g8r+5BorD9PuISTIOfNweuNsBBsIIdFKX+3YOlUERoyy N5cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OhMjMUVS; 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 bs5-20020a170906d1c500b0072a84586c63si8792308ejb.564.2022.08.01.18.59.47; Mon, 01 Aug 2022 19:00:12 -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=OhMjMUVS; 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 S235604AbiHBBw1 (ORCPT + 99 others); Mon, 1 Aug 2022 21:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235596AbiHBBwS (ORCPT ); Mon, 1 Aug 2022 21:52:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DD3A48CBC; Mon, 1 Aug 2022 18:52:01 -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 dfw.source.kernel.org (Postfix) with ESMTPS id AF8C861083; Tue, 2 Aug 2022 01:52:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F78EC433B5; Tue, 2 Aug 2022 01:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659405120; bh=59TymRezo4AowK7BYVDr168MBiVlGWeji5p02ankQ3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhMjMUVSnExbAiphhJuOmteyMAD8UK8qKnI76JZjTcj4qm7UDrmjKhdqxDA31G1X5 s2VJuUoLD+HQ+pr5wM3QWL9H/SF20/CIgaTcLVfwwIfK6C4S8HoE4pXO45y71Kq3i8 lfCWk2wXPhm26ZubpAf7ohEoA+E5VMRXReCeD22ltIsZHbZ5eNSNGNSd3HGX0VlZxd LcCRirFJt+pBDsVbncbMarzZZTbp9lvhks6xNIsuFPYBMgmV5CYPhb0s+O3LqNpu3S wWFzgx5zLSW14nRP+gg6H/vHpuw1/IxZdrizTHLH93/SyK4MalTMzubeobO+pnNlgJ 17v1xvibEolcg== 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 08/31] locking/spinlock: introduce `_raw_spin_lock_init` Date: Tue, 2 Aug 2022 03:49:55 +0200 Message-Id: <20220802015052.10452-9-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 `raw_spin_lock_init` with a passed key, rather than define one in place. In order to do that, this changes the `raw_spin_lock_init` macro to call a new `_raw_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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index ad1c91884ed8..27df5380c1e4 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -99,11 +99,17 @@ extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, struct lock_class_key *key, short inner); +static inline void _raw_spin_lock_init(raw_spinlock_t *lock, const char *name, + struct lock_class_key *key) +{ + __raw_spin_lock_init(lock, name, key, LD_WAIT_SPIN); +} + # define raw_spin_lock_init(lock) \ do { \ static struct lock_class_key __key; \ \ - __raw_spin_lock_init((lock), #lock, &__key, LD_WAIT_SPIN); \ + _raw_spin_lock_init((lock), #lock, &__key); \ } while (0) #else -- 2.37.1