diff options
| author | Daniel Almeida <daniel.almeida@collabora.com> | 2026-03-23 20:27:02 -0300 |
|---|---|---|
| committer | Alice Ryhl <aliceryhl@google.com> | 2026-03-26 13:08:49 +0000 |
| commit | 206bada308d0d715d62ac841784af34a2ca22ff6 (patch) | |
| tree | 92450219421a22131d1c112341301f1c148d4871 /rust/kernel | |
| parent | 332666484f06cd85ad382329f5b3165aa627e9f8 (diff) | |
| download | linux-206bada308d0d715d62ac841784af34a2ca22ff6.tar.gz linux-206bada308d0d715d62ac841784af34a2ca22ff6.zip | |
rust: drm: dispatch delayed work items to the private data
Much like the patch that dispatched (regular) work items, we also need to
dispatch delayed work items in order not to trigger the orphan rule. This
allows a drm::Device<T> to dispatch the delayed work to T::Data.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://lore.kernel.org/r/20260323-aref-workitem-v3-4-f59729b812aa@collabora.com
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Diffstat (limited to 'rust/kernel')
| -rw-r--r-- | rust/kernel/drm/device.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs index 5db5c7e3bb7a..adbafe8db54d 100644 --- a/rust/kernel/drm/device.rs +++ b/rust/kernel/drm/device.rs @@ -19,6 +19,7 @@ use crate::{ }, types::Opaque, workqueue::{ + HasDelayedWork, HasWork, Work, WorkItem, // @@ -291,3 +292,15 @@ where unsafe { crate::container_of!(data_ptr, Self, data) } } } + +// SAFETY: Our `HasWork<T, ID>` implementation returns a `work_struct` that is +// stored in the `work` field of a `delayed_work` with the same access rules as +// the `work_struct` owing to the bound on `T::Data: HasDelayedWork<Device<T>, +// ID>`, which requires that `T::Data::raw_get_work` return a `work_struct` that +// is inside a `delayed_work`. +unsafe impl<T, const ID: u64> HasDelayedWork<Device<T>, ID> for Device<T> +where + T: drm::Driver, + T::Data: HasDelayedWork<Device<T>, ID>, +{ +} |
