[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241119231146.2298971-3-lyude@redhat.com>
Date: Tue, 19 Nov 2024 18:11:04 -0500
From: Lyude Paul <lyude@...hat.com>
To: rust-for-linux@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Martin Rodriguez Reboredo <yakoyoku@...il.com>,
Valentin Obst <kernel@...entinobst.de>,
Filipe Xavier <felipe_life@...e.com>
Subject: [PATCH v4 2/2] rust: sync: Make Guard::new() public
Since we added a Lock::from_raw() function previously, it makes sense to
also introduce an interface for creating a Guard from a reference to a Lock
for instances where we've derived the Lock from a raw pointer and know that
the lock is already acquired, something we do in the KMS API.
Signed-off-by: Lyude Paul <lyude@...hat.com>
---
rust/kernel/sync/lock.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs
index ea65f84b76f8e..139f17f2ec86b 100644
--- a/rust/kernel/sync/lock.rs
+++ b/rust/kernel/sync/lock.rs
@@ -229,7 +229,7 @@ impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> {
/// # Safety
///
/// The caller must ensure that it owns the lock.
- pub(crate) unsafe fn new(lock: &'a Lock<T, B>, state: B::GuardState) -> Self {
+ pub unsafe fn new(lock: &'a Lock<T, B>, state: B::GuardState) -> Self {
Self {
lock,
state,
--
2.47.0
Powered by blists - more mailing lists