diff options
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/kernel/sync.rs | 16 | 
1 files changed, 4 insertions, 12 deletions
| diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs index 3498fb344dc9..16eab9138b2b 100644 --- a/rust/kernel/sync.rs +++ b/rust/kernel/sync.rs @@ -30,28 +30,20 @@ pub struct LockClassKey(Opaque<bindings::lock_class_key>);  unsafe impl Sync for LockClassKey {}  impl LockClassKey { -    /// Creates a new lock class key. -    pub const fn new() -> Self { -        Self(Opaque::uninit()) -    } -      pub(crate) fn as_ptr(&self) -> *mut bindings::lock_class_key {          self.0.get()      }  } -impl Default for LockClassKey { -    fn default() -> Self { -        Self::new() -    } -} -  /// Defines a new static lock class and returns a pointer to it.  #[doc(hidden)]  #[macro_export]  macro_rules! static_lock_class {      () => {{ -        static CLASS: $crate::sync::LockClassKey = $crate::sync::LockClassKey::new(); +        static CLASS: $crate::sync::LockClassKey = +            // SAFETY: lockdep expects uninitialized memory when it's handed a statically allocated +            // lock_class_key +            unsafe { ::core::mem::MaybeUninit::uninit().assume_init() };          &CLASS      }};  } | 
