@@ -77,7 +77,7 @@ pub unsafe trait Backend {
7777///
7878/// Exposes one of the kernel locking primitives. Which one is exposed depends on the lock
7979/// [`Backend`] specified as the generic parameter `B`.
80- #[ cfg( not( CONFIG_RROS ) ) ]
80+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
8181#[ pin_data]
8282pub struct Lock < T : ?Sized , B : Backend > {
8383 /// The kernel lock object.
@@ -95,15 +95,15 @@ pub struct Lock<T: ?Sized, B: Backend> {
9595}
9696
9797// SAFETY: `Lock` can be transferred across thread boundaries iff the data it protects can.
98- #[ cfg( not( CONFIG_RROS ) ) ]
98+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
9999unsafe impl < T : ?Sized + Send , B : Backend > Send for Lock < T , B > { }
100100
101101// SAFETY: `Lock` serialises the interior mutability it provides, so it is `Sync` as long as the
102102// data it protects is `Send`.
103- #[ cfg( not( CONFIG_RROS ) ) ]
103+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
104104unsafe impl < T : ?Sized + Send , B : Backend > Sync for Lock < T , B > { }
105105
106- #[ cfg( not( CONFIG_RROS ) ) ]
106+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
107107impl < T , B : Backend > Lock < T , B > {
108108 /// Constructs a new lock initialiser.
109109 #[ allow( clippy:: new_ret_no_self) ]
@@ -120,7 +120,7 @@ impl<T, B: Backend> Lock<T, B> {
120120 }
121121}
122122
123- #[ cfg( not( CONFIG_RROS ) ) ]
123+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
124124impl < T : ?Sized , B : Backend > Lock < T , B > {
125125 /// Acquires the lock and gives the caller access to the data protected by it.
126126 pub fn lock ( & self ) -> Guard < ' _ , T , B > {
@@ -137,7 +137,7 @@ impl<T: ?Sized, B: Backend> Lock<T, B> {
137137/// Allows mutual exclusion primitives that implement the [`Backend`] trait to automatically unlock
138138/// when a guard goes out of scope. It also provides a safe and convenient way to access the data
139139/// protected by the lock.
140- #[ cfg( not( CONFIG_RROS ) ) ]
140+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
141141#[ must_use = "the lock unlocks immediately when the guard is unused" ]
142142pub struct Guard < ' a , T : ?Sized , B : Backend > {
143143 pub ( crate ) lock : & ' a Lock < T , B > ,
@@ -146,10 +146,10 @@ pub struct Guard<'a, T: ?Sized, B: Backend> {
146146}
147147
148148// SAFETY: `Guard` is sync when the data protected by the lock is also sync.
149- #[ cfg( not( CONFIG_RROS ) ) ]
149+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
150150unsafe impl < T : Sync + ?Sized , B : Backend > Sync for Guard < ' _ , T , B > { }
151151
152- #[ cfg( not( CONFIG_RROS ) ) ]
152+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
153153impl < T : ?Sized , B : Backend > Guard < ' _ , T , B > {
154154 pub ( crate ) fn do_unlocked ( & mut self , cb : impl FnOnce ( ) ) {
155155 // SAFETY: The caller owns the lock, so it is safe to unlock it.
@@ -163,7 +163,7 @@ impl<T: ?Sized, B: Backend> Guard<'_, T, B> {
163163 }
164164}
165165
166- #[ cfg( not( CONFIG_RROS ) ) ]
166+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
167167impl < T : ?Sized , B : Backend > core:: ops:: Deref for Guard < ' _ , T , B > {
168168 type Target = T ;
169169
@@ -173,23 +173,23 @@ impl<T: ?Sized, B: Backend> core::ops::Deref for Guard<'_, T, B> {
173173 }
174174}
175175
176- #[ cfg( not( CONFIG_RROS ) ) ]
176+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
177177impl < T : ?Sized , B : Backend > core:: ops:: DerefMut for Guard < ' _ , T , B > {
178178 fn deref_mut ( & mut self ) -> & mut Self :: Target {
179179 // SAFETY: The caller owns the lock, so it is safe to deref the protected data.
180180 unsafe { & mut * self . lock . data . get ( ) }
181181 }
182182}
183183
184- #[ cfg( not( CONFIG_RROS ) ) ]
184+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
185185impl < T : ?Sized , B : Backend > Drop for Guard < ' _ , T , B > {
186186 fn drop ( & mut self ) {
187187 // SAFETY: The caller owns the lock, so it is safe to unlock it.
188188 unsafe { B :: unlock ( self . lock . state . get ( ) , & self . state ) } ;
189189 }
190190}
191191
192- #[ cfg( not( CONFIG_RROS ) ) ]
192+ #[ cfg( not( CONFIG_RROS_SPINLOCK ) ) ]
193193impl < ' a , T : ?Sized , B : Backend > Guard < ' a , T , B > {
194194 /// Constructs a new immutable lock guard.
195195 ///
@@ -247,7 +247,7 @@ pub trait NeedsLockClass {
247247}
248248
249249/// Reschedules the caller's task if needed.
250- #[ cfg( CONFIG_RROS ) ]
250+ #[ cfg( CONFIG_RROS_SPINLOCK ) ]
251251pub fn cond_resched ( ) -> bool {
252252 // SAFETY: No arguments, reschedules `current` if needed.
253253 unsafe { rust_helper_cond_resched ( ) != 0 }
0 commit comments