Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Daniel Almeida and committed by
Alice Ryhl
206bada3 33266648

+13
+13
rust/kernel/drm/device.rs
··· 19 19 }, 20 20 types::Opaque, 21 21 workqueue::{ 22 + HasDelayedWork, 22 23 HasWork, 23 24 Work, 24 25 WorkItem, // ··· 291 290 // SAFETY: `T::Data` is stored as the `data` field in `Device<T>`. 292 291 unsafe { crate::container_of!(data_ptr, Self, data) } 293 292 } 293 + } 294 + 295 + // SAFETY: Our `HasWork<T, ID>` implementation returns a `work_struct` that is 296 + // stored in the `work` field of a `delayed_work` with the same access rules as 297 + // the `work_struct` owing to the bound on `T::Data: HasDelayedWork<Device<T>, 298 + // ID>`, which requires that `T::Data::raw_get_work` return a `work_struct` that 299 + // is inside a `delayed_work`. 300 + unsafe impl<T, const ID: u64> HasDelayedWork<Device<T>, ID> for Device<T> 301 + where 302 + T: drm::Driver, 303 + T::Data: HasDelayedWork<Device<T>, ID>, 304 + { 294 305 }