[PATCH v4 2/2] rust: sync: Make Guard::new() public

Lyude Paul posted 2 patches 5 days ago
[PATCH v4 2/2] rust: sync: Make Guard::new() public
Posted by Lyude Paul 5 days ago
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@redhat.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