diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2025-02-25 16:03:25 -0800 | 
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2025-02-25 16:03:25 -0800 | 
| commit | 0b119045b79a672bc6d8f18641c60fc8ce1b4585 (patch) | |
| tree | 69c63ecfec55b9576c34dc742e0c38f46f8a317a /rust/kernel/sync/lock/mutex.rs | |
| parent | 7f7573bd4f37d4edc168c5b5def0bc2a1951c657 (diff) | |
| parent | d082ecbc71e9e0bf49883ee4afd435a77a5101b6 (diff) | |
Merge tag 'v6.14-rc4' into next
Sync up with the mainline.
Diffstat (limited to 'rust/kernel/sync/lock/mutex.rs')
| -rw-r--r-- | rust/kernel/sync/lock/mutex.rs | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/rust/kernel/sync/lock/mutex.rs b/rust/kernel/sync/lock/mutex.rs index 0e946ebefce1..70cadbc2e8e2 100644 --- a/rust/kernel/sync/lock/mutex.rs +++ b/rust/kernel/sync/lock/mutex.rs @@ -86,6 +86,14 @@ pub use new_mutex;  /// [`struct mutex`]: srctree/include/linux/mutex.h  pub type Mutex<T> = super::Lock<T, MutexBackend>; +/// A [`Guard`] acquired from locking a [`Mutex`]. +/// +/// This is simply a type alias for a [`Guard`] returned from locking a [`Mutex`]. It will unlock +/// the [`Mutex`] upon being dropped. +/// +/// [`Guard`]: super::Guard +pub type MutexGuard<'a, T> = super::Guard<'a, T, MutexBackend>; +  /// A kernel `struct mutex` lock backend.  pub struct MutexBackend; @@ -126,4 +134,9 @@ unsafe impl super::Backend for MutexBackend {              None          }      } + +    unsafe fn assert_is_held(ptr: *mut Self::State) { +        // SAFETY: The `ptr` pointer is guaranteed to be valid and initialized before use. +        unsafe { bindings::mutex_assert_is_held(ptr) } +    }  } | 
