3
3
//! Rros Memory.
4
4
use crate :: timekeeping:: * ;
5
5
use crate :: { bindings, Result } ;
6
- use crate :: { c_types, mm, prelude:: * , premmpt, spinlock_init , sync:: SpinLock , vmalloc} ;
6
+ use crate :: { c_types, mm, prelude:: * , premmpt, new_spinlock , sync:: SpinLock , vmalloc} ;
7
7
use core:: { mem:: size_of, ptr:: addr_of_mut} ;
8
8
9
9
const PAGE_SIZE : u32 = 4096 as u32 ;
@@ -175,7 +175,7 @@ pub struct RrosHeap {
175
175
pub buckets : [ u32 ; RROS_HEAP_MAX_BUCKETS as usize ] ,
176
176
/// `lock` is an optional SpinLock used for ensuring thread-safety in the `RrosHeap`.
177
177
/// It is initialized in the `init` method of the `RrosHeap` struct.
178
- pub lock : Option < SpinLock < i32 > > ,
178
+ pub lock : Option < Pin < Box < SpinLock < i32 > > > > ,
179
179
}
180
180
181
181
/// Implementation of the `RrosHeap` struct.
@@ -192,9 +192,7 @@ impl RrosHeap {
192
192
return Err ( crate :: Error :: EINVAL ) ;
193
193
}
194
194
195
- let mut spinlock = unsafe { SpinLock :: new ( 1 ) } ;
196
- let pinned = unsafe { Pin :: new_unchecked ( & mut spinlock) } ;
197
- spinlock_init ! ( pinned, "spinlock" ) ;
195
+ let mut spinlock = Box :: pin_init ( new_spinlock ! ( 1 as i32 , "spinlock" , ) ) . unwrap ( ) ;
198
196
self . lock = Some ( spinlock) ;
199
197
200
198
for i in self . buckets . iter_mut ( ) {
0 commit comments