diff options
author | Danilo Krummrich <dakr@redhat.com> | 2024-06-24 20:44:33 +0200 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2024-08-13 16:05:29 +0200 |
commit | d0f65424d73d530db264430345f96332a65d167a (patch) | |
tree | 5b7868cec2074bf70c33dfba164f08fa6e7fa82d /rust/kernel/drm/file.rs | |
parent | 958c08c9a2df308dc38beed80d9649f585556978 (diff) |
rust: treewide: nova-next: switch to `KBox`
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Diffstat (limited to 'rust/kernel/drm/file.rs')
-rw-r--r-- | rust/kernel/drm/file.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/rust/kernel/drm/file.rs b/rust/kernel/drm/file.rs index 0b6366734c61..523ce136226e 100644 --- a/rust/kernel/drm/file.rs +++ b/rust/kernel/drm/file.rs @@ -4,8 +4,7 @@ //! //! C header: [`include/linux/drm/drm_file.h`](srctree/include/linux/drm/drm_file.h) -use crate::{bindings, drm, error::Result}; -use alloc::boxed::Box; +use crate::{alloc::KBox, bindings, drm, error::Result}; use core::marker::PhantomData; use core::pin::Pin; @@ -15,7 +14,7 @@ pub trait DriverFile { type Driver: drm::drv::Driver; /// Open a new file (called when a client opens the DRM device). - fn open(device: &drm::device::Device<Self::Driver>) -> Result<Pin<Box<Self>>>; + fn open(device: &drm::device::Device<Self::Driver>) -> Result<Pin<KBox<Self>>>; } /// An open DRM File. @@ -45,7 +44,7 @@ pub(super) unsafe extern "C" fn open_callback<T: DriverFile>( }; // SAFETY: This pointer is treated as pinned, and the Drop guarantee is upheld below. - file.driver_priv = Box::into_raw(unsafe { Pin::into_inner_unchecked(inner) }) as *mut _; + file.driver_priv = KBox::into_raw(unsafe { Pin::into_inner_unchecked(inner) }) as *mut _; 0 } @@ -60,7 +59,7 @@ pub(super) unsafe extern "C" fn postclose_callback<T: DriverFile>( // Drop the DriverFile unsafe { - let _ = Box::from_raw(file.driver_priv as *mut T); + let _ = KBox::from_raw(file.driver_priv as *mut T); }; } |