55//! C header: [`include/linux/soc/apple/rtkit.h`](../../../../include/linux/gpio/driver.h)
66
77use crate :: {
8- alloc:: { box_ext :: BoxExt , flags:: * } ,
8+ alloc:: flags:: * ,
99 bindings, device,
1010 error:: { code:: * , from_err_ptr, from_result, to_result, Result } ,
11+ prelude:: KBox ,
1112 str:: CStr ,
1213 types:: { ForeignOwnable , ScopeGuard } ,
1314} ;
1415
15- use alloc:: boxed:: Box ;
1616use core:: marker:: PhantomData ;
1717use core:: ptr;
1818use macros:: vtable;
@@ -149,8 +149,8 @@ unsafe extern "C" fn shmem_setup_callback<T: Operations>(
149149
150150 // Now box the returned buffer type and stash it in the private pointer of the
151151 // `apple_rtkit_shmem` struct for safekeeping.
152- let boxed = Box :: new ( buf, GFP_KERNEL ) ?;
153- bfr_mut. private = Box :: into_raw ( boxed) as * mut _ ;
152+ let boxed = KBox :: new ( buf, GFP_KERNEL ) ?;
153+ bfr_mut. private = KBox :: into_raw ( boxed) as * mut _ ;
154154 Ok ( 0 )
155155 } )
156156}
@@ -164,7 +164,7 @@ unsafe extern "C" fn shmem_destroy_callback<T: Operations>(
164164 if !bfr_mut. private . is_null ( ) {
165165 // SAFETY: Per shmem_setup_callback, this has to be a pointer to a Buffer if it is set.
166166 unsafe {
167- core:: mem:: drop ( Box :: from_raw ( bfr_mut. private as * mut T :: Buffer ) ) ;
167+ core:: mem:: drop ( KBox :: from_raw ( bfr_mut. private as * mut T :: Buffer ) ) ;
168168 }
169169 bfr_mut. private = core:: ptr:: null_mut ( ) ;
170170 }
@@ -189,7 +189,7 @@ impl<T: Operations> RtKit<T> {
189189
190190 /// Creates a new RTKit client for a given device and optional mailbox name or index.
191191 pub fn new (
192- dev : & dyn device:: RawDevice ,
192+ dev : & device:: Device ,
193193 mbox_name : Option < & ' static CStr > ,
194194 mbox_idx : usize ,
195195 data : T :: Data ,
@@ -199,10 +199,11 @@ impl<T: Operations> RtKit<T> {
199199 // SAFETY: `ptr` came from a previous call to `into_foreign`.
200200 unsafe { T :: Data :: from_foreign ( ptr) } ;
201201 } ) ;
202- // SAFETY: This just calls the C init function.
202+ // SAFETY: `dev` is valid by its type invarants and otherwise his just
203+ // calls the C init function.
203204 let rtk = unsafe {
204205 from_err_ptr ( bindings:: apple_rtkit_init (
205- dev. raw_device ( ) ,
206+ dev. as_raw ( ) ,
206207 ptr,
207208 match mbox_name {
208209 Some ( s) => s. as_char_ptr ( ) ,
0 commit comments