diff options
author | Asahi Lina <lina@asahilina.net> | 2025-04-11 01:55:25 +0200 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-04-24 14:11:58 +0200 |
commit | a98a73be9ee9c42495690b2fe56e1ce27768289a (patch) | |
tree | 0bff4bb62cb35944fe70b9f438a391d9766e4de8 /rust/kernel/drm/device.rs | |
parent | 0600032c54b7adc309d334c109374433ce3ab243 (diff) |
rust: drm: file: Add File abstraction
A DRM File is the DRM counterpart to a kernel file structure,
representing an open DRM file descriptor.
Add a Rust abstraction to allow drivers to implement their own File types
that implement the DriverFile trait.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Asahi Lina <lina@asahilina.net>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://lore.kernel.org/r/20250410235546.43736-7-dakr@kernel.org
[ Rework of drm::File
* switch to the Opaque<T> type
* fix (mutable) references to struct drm_file (which in this context
is UB)
* restructure and rename functions to align with common kernel
schemes
* write and fix safety and invariant comments
* remove necessity for and convert 'as' casts
* original source archive: https://archive.is/GH8oy
- Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/drm/device.rs')
-rw-r--r-- | rust/kernel/drm/device.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs index d6c6cecbdd51..520f51bb40af 100644 --- a/rust/kernel/drm/device.rs +++ b/rust/kernel/drm/device.rs @@ -63,8 +63,8 @@ pub struct Device<T: drm::Driver> { impl<T: drm::Driver> Device<T> { const VTABLE: bindings::drm_driver = drm_legacy_fields! { load: None, - open: None, // TODO: File abstraction - postclose: None, // TODO: File abstraction + open: Some(drm::File::<T::File>::open_callback), + postclose: Some(drm::File::<T::File>::postclose_callback), unload: None, release: None, master_set: None, |