33//! Rros Memory.
44use crate :: timekeeping:: * ;
55use 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} ;
77use core:: { mem:: size_of, ptr:: addr_of_mut} ;
88
99const PAGE_SIZE : u32 = 4096 as u32 ;
@@ -175,7 +175,7 @@ pub struct RrosHeap {
175175 pub buckets : [ u32 ; RROS_HEAP_MAX_BUCKETS as usize ] ,
176176 /// `lock` is an optional SpinLock used for ensuring thread-safety in the `RrosHeap`.
177177 /// 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 > > > > ,
179179}
180180
181181/// Implementation of the `RrosHeap` struct.
@@ -192,9 +192,7 @@ impl RrosHeap {
192192 return Err ( crate :: Error :: EINVAL ) ;
193193 }
194194
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 ( ) ;
198196 self . lock = Some ( spinlock) ;
199197
200198 for i in self . buckets . iter_mut ( ) {
0 commit comments