From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C8FE30102B for ; Tue, 2 Dec 2025 19:38:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764704320; cv=none; b=S/w3N3YOKiw7CkkLtJQYhzKHG4t8ZQfbc1vzRXJzqntha+syTQPNpOzh8oqQRBjAp1RScswXvC+FGED/LCfVlK913hU7LLcOSS++9JdVGGxkoZLcz+CsWWwpx4R+plc4M+o4rOXNhqYwUvvvG1OR6uW11dkpnCJjeZX7/sBIPmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764704320; c=relaxed/simple; bh=9sd35dLjfBIr4ySTscB92KQs0hjfJ9K08rqyCMh11R0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HPg57ZDC+G0249Hsskv/GH0plKsEjVdbYBPOx0xnXnn+zHmTnXKPk0+3dbJERWbcQ7YCAbylXZLEwSd1gua/X0wr7SZXB7VZpfiaHOunqCTujSIkdtX+cTjP1wpF5qKhMYT9uME3rfjHgw5xWCmbGloFOTE1/CfevWorwA91ET0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=VjrIwbVB; arc=none smtp.client-ip=209.85.218.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VjrIwbVB" Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-b735eea0bddso468303566b.2 for ; Tue, 02 Dec 2025 11:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764704317; x=1765309117; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=BcTtAwcIUdoQIiOTydVG9uZu0V4P1X92ytgjA3f10BE=; b=VjrIwbVBPQdPS3zCrXkwMv33/2BMk79s+FfZ/E8NRiB5MxShZYth+vYNYTIL2tVv6T UeZTpe4dhep+66rKfyxWtnMidUdV5JvKPC9DLJPV447RNHGFA0WTwR+TxZUra9fslYLc CP5OmFMmE9KJ3tw4GsHG00VlGJwOYNZmiN192C7Y4DK2zqvjD4K+mTqfvFevlc7z/EMl A8ZGW/eRmioyVF6dO8H9R1ZcHuQ8hR+zJumPyRX4ivXzwOO6SUa0Cmz6W3VIp6Y4QhAC HIYRFBXOjhOJBBwGsYWIEcGayFJ+CXaDFbOzYQ1+PPf6xEwcpQjGf4yAfchw/qNxInj3 NxXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764704317; x=1765309117; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BcTtAwcIUdoQIiOTydVG9uZu0V4P1X92ytgjA3f10BE=; b=goC3X7OdMQXY55oD4sB3/LFeeq5bunS/4i0BtWOdg0iuXLZtm3vyFpCmvlmB8hbu70 zx2nFMJZzHbhNSgfS16wAGUEHi2MYhpaN8NnIRRGcGK3Krn54AGOaRIvvyeMUP9V9CcY 3lwWtbnCXYYnDaoxxO99R9wjLSaly6O0RIjFzscpetnpjlSp3von2mV+3zpKDOne7C8Z SDQHul8YW8v4YAiZ8uTdDiCwGwNmCfrjmxRsVqJLpAlnqf+rKQKgZ4Q1yjstsgdEXBiH uyEOfiog4hevDMff1E/X2MMkSAEfycrZFUf0Zhj4LzwbwILkJZBKMIV9i1JG/nleWKkf 6yrA== X-Gm-Message-State: AOJu0YxhEEo8dvnFnBtmRUBl8FXi5R0i5ux8JL7lZInMP0QgLZ+SH8Dh z72G35cbABmml3+BjvTS5wMOC9Aqq3leR8BlTRFcn2q7Yb8O1s5XUhgCZCNiaaaCiV8GZqy6VP9 FIxipxe2OFHnU2mY/8Q== X-Google-Smtp-Source: AGHT+IFx8QUiRueY0SUcnLRlCKX1GgoenQ+z+9TsVrAIG6VQYyC2OT8A4BtrIEIJyfslJuVypkcQKxxuZt2+Wzo= X-Received: from ejcrl22.prod.google.com ([2002:a17:907:6c16:b0:b73:6fbe:a15e]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:728a:b0:b73:8d2e:2d38 with SMTP id a640c23a62f3a-b76718ba73bmr4763116966b.50.1764704317658; Tue, 02 Dec 2025 11:38:37 -0800 (PST) Date: Tue, 02 Dec 2025 19:38:03 +0000 In-Reply-To: <20251202-define-rust-helper-v1-0-a2e13cbc17a6@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251202-define-rust-helper-v1-0-a2e13cbc17a6@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=3754; i=aliceryhl@google.com; h=from:subject:message-id; bh=9sd35dLjfBIr4ySTscB92KQs0hjfJ9K08rqyCMh11R0=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpL0ALY7CC84fe2jOMgOdOpe3kwEvaxpWHppCWj nxPnGhkIVaJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaS9ACwAKCRAEWL7uWMY5 RgAmEACnn1+0gHmj8o9AQH30HSt0Y9nJ2a4rjg7INu0yP5tL380pnhyRJZshrwufQqH0d0DuNRw PSiQo6QvjSVCPjBvLrTcLrNtpdyDjYRsmR1B7PhWIeU8LamfDtWKzo28/LFsoQSHusrtKbViWPi gAn+IJvmlnZwp1GATVDiDq1xXh+3jcxS1j7gIpqfybC4vCYvI1Xq5cOj0zRz79PG9+AqY1mIe9/ 9AZj2N7mEePSiusMhE2vwvGFazatSteR6+Zgdh3o/3VEHrYcngxpink3uMXRfvk/XfrgPRE+6c8 pcUo5CZcM9NCe9NeE2+KUPmYeB78rgjvNlJ+wMQ+cLl8J4gNp22+uXY8x7CaigZbOBwC2GK6MsH LTxXJYi9gKyjltl5N1Gzi507hjHoPgRTj+Tmx/1PaHO9v/hz3kMZMt05dVLXhZ7JdqyGGjZvL/g oTVj6RBQWXt0mnLpZRTgVpTpfe77PzFV5/PP3M+9gqbVgu/ndXQ0DEmmKBMeGGTPpXr8TMcIymR cV8TRdHplLpCKStdFxni9Z6mQMeS4YTububLo7m6BLFp6LZ+r5w7XzsP+kZpDhlDWhoeqjVE2Nd hQEF9uIay0s/DU2JzW7uYZz9enEOdKBNV6rHI/w9MLjmPKJGDlVZ2R37tr48M3OcMyv5u9mXUpo d4YNdo+gOEPDceQ== X-Mailer: b4 0.14.2 Message-ID: <20251202-define-rust-helper-v1-39-a2e13cbc17a6@google.com> Subject: [PATCH 39/46] rust: sync: add __rust_helper to helpers From: Alice Ryhl To: rust-for-linux@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Alice Ryhl , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , Mitchell Levy , Benno Lossin Content-Type: text/plain; charset="utf-8" This is needed to inline these helpers into Rust code. Signed-off-by: Alice Ryhl --- Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon Cc: Boqun Feng Cc: Waiman Long Cc: Mitchell Levy Cc: Benno Lossin --- rust/helpers/mutex.c | 13 +++++++------ rust/helpers/spinlock.c | 13 +++++++------ rust/helpers/sync.c | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c index e487819125f0dfe0741601205e8f84d322c973d5..1b07d6e64299d509bc3ce1af99b19aa97b721fc6 100644 --- a/rust/helpers/mutex.c +++ b/rust/helpers/mutex.c @@ -2,28 +2,29 @@ #include -void rust_helper_mutex_lock(struct mutex *lock) +__rust_helper void rust_helper_mutex_lock(struct mutex *lock) { mutex_lock(lock); } -int rust_helper_mutex_trylock(struct mutex *lock) +__rust_helper int rust_helper_mutex_trylock(struct mutex *lock) { return mutex_trylock(lock); } -void rust_helper___mutex_init(struct mutex *mutex, const char *name, - struct lock_class_key *key) +__rust_helper void rust_helper___mutex_init(struct mutex *mutex, + const char *name, + struct lock_class_key *key) { __mutex_init(mutex, name, key); } -void rust_helper_mutex_assert_is_held(struct mutex *mutex) +__rust_helper void rust_helper_mutex_assert_is_held(struct mutex *mutex) { lockdep_assert_held(mutex); } -void rust_helper_mutex_destroy(struct mutex *lock) +__rust_helper void rust_helper_mutex_destroy(struct mutex *lock) { mutex_destroy(lock); } diff --git a/rust/helpers/spinlock.c b/rust/helpers/spinlock.c index 42c4bf01a23e4003ea82c65b16bc8f495ad37750..4d13062cf253e67894aaa9ba968ff381db2c651e 100644 --- a/rust/helpers/spinlock.c +++ b/rust/helpers/spinlock.c @@ -2,8 +2,9 @@ #include -void rust_helper___spin_lock_init(spinlock_t *lock, const char *name, - struct lock_class_key *key) +__rust_helper void rust_helper___spin_lock_init(spinlock_t *lock, + const char *name, + struct lock_class_key *key) { #ifdef CONFIG_DEBUG_SPINLOCK # if defined(CONFIG_PREEMPT_RT) @@ -16,22 +17,22 @@ void rust_helper___spin_lock_init(spinlock_t *lock, const char *name, #endif /* CONFIG_DEBUG_SPINLOCK */ } -void rust_helper_spin_lock(spinlock_t *lock) +__rust_helper void rust_helper_spin_lock(spinlock_t *lock) { spin_lock(lock); } -void rust_helper_spin_unlock(spinlock_t *lock) +__rust_helper void rust_helper_spin_unlock(spinlock_t *lock) { spin_unlock(lock); } -int rust_helper_spin_trylock(spinlock_t *lock) +__rust_helper int rust_helper_spin_trylock(spinlock_t *lock) { return spin_trylock(lock); } -void rust_helper_spin_assert_is_held(spinlock_t *lock) +__rust_helper void rust_helper_spin_assert_is_held(spinlock_t *lock) { lockdep_assert_held(lock); } diff --git a/rust/helpers/sync.c b/rust/helpers/sync.c index ff7e68b4881011ce0aa9beb2df14bf0ffd147337..82d6aff73b04f0ab1030bb5170e40ed6ccac41c0 100644 --- a/rust/helpers/sync.c +++ b/rust/helpers/sync.c @@ -2,12 +2,12 @@ #include -void rust_helper_lockdep_register_key(struct lock_class_key *k) +__rust_helper void rust_helper_lockdep_register_key(struct lock_class_key *k) { lockdep_register_key(k); } -void rust_helper_lockdep_unregister_key(struct lock_class_key *k) +__rust_helper void rust_helper_lockdep_unregister_key(struct lock_class_key *k) { lockdep_unregister_key(k); } -- 2.52.0.158.g65b55ccf14-goog