diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs index 871f3d3bd55f98213baa5afbd6d5eff6cfe5bec6..df3bbe97203f3522b7e75929a8868f92e12a0de8 100644 --- a/rust/kernel/sync.rs +++ b/rust/kernel/sync.rs @@ -17,7 +17,14 @@ pub use arc::{Arc, ArcBorrow, UniqueArc}; pub use condvar::{new_condvar, CondVar, CondVarTimeoutResult}; pub use lock::global::{global_lock, GlobalGuard, GlobalLock, GlobalLockBackend, GlobalLockedBy}; pub use lock::mutex::{new_mutex, Mutex, MutexGuard}; -pub use lock::spinlock::{new_spinlock, new_spinlock_irq, SpinLock, SpinLockGuard, SpinLockIrq}; +pub use lock::spinlock::{ + new_spinlock, + new_spinlock_irq, + SpinLock, + SpinLockGuard, + SpinLockIrq, + SpinLockIrqGuard, +}; pub use locked_by::LockedBy; /// Represents a lockdep class. It's a wrapper around C's `lock_class_key`. diff --git a/rust/kernel/sync/lock/spinlock.rs b/rust/kernel/sync/lock/spinlock.rs index 67fb3bddb2c0d9a77b29a18c241b4492ff2e0a67..ef8ab88e70723020d5e10d6ff14a3733ed04041b 100644 --- a/rust/kernel/sync/lock/spinlock.rs +++ b/rust/kernel/sync/lock/spinlock.rs @@ -216,6 +216,14 @@ pub use new_spinlock_irq; /// ``` pub type SpinLockIrq<T> = super::Lock<T, SpinLockIrqBackend>; +/// A [`Guard`] acquired from locking a [`SpinLockIrq`]. +/// +/// This is simply a type alias for a [`Guard`] returned from locking a [`SpinLockIrq`]. It will +/// unlock the [`SpinLockIrq`] upon being dropped. +/// +/// [`Guard`]: super::Guard +pub type SpinLockIrqGuard<'a, T: ?Sized> = super::Guard<'a, T, SpinLockIrqBackend>; + /// A kernel `spinlock_t` lock backend that is acquired in no-irq contexts. pub struct SpinLockIrqBackend;