Skip to content

Commit daa03fe

Browse files
Lyudefbq
authored andcommitted
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, there are such usages in KMS API. [Boqun: Add backquotes to type names, reformat the commit log, reword a bit on the usage of KMS API] Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Filipe Xavier <felipe_life@live.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Link: https://lore.kernel.org/r/20241119231146.2298971-3-lyude@redhat.com
1 parent 15abc88 commit daa03fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rust/kernel/sync/lock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> {
234234
/// # Safety
235235
///
236236
/// The caller must ensure that it owns the lock.
237-
pub(crate) unsafe fn new(lock: &'a Lock<T, B>, state: B::GuardState) -> Self {
237+
pub unsafe fn new(lock: &'a Lock<T, B>, state: B::GuardState) -> Self {
238238
Self {
239239
lock,
240240
state,

0 commit comments

Comments
 (0)