]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: drm: dispatch work items to the private data
authorDaniel Almeida <daniel.almeida@collabora.com>
Mon, 23 Mar 2026 23:27:00 +0000 (20:27 -0300)
committerAlice Ryhl <aliceryhl@google.com>
Thu, 26 Mar 2026 13:08:48 +0000 (13:08 +0000)
commit72a723df8decf70e04f799a6defda8bb62d41848
tree3e58729d9e410e399189d5653fe1cd322f7faef5
parentf5e841e4966c1873b9bb2c69d07947a54284e5eb
rust: drm: dispatch work items to the private data

This implementation dispatches any work enqueued on ARef<drm::Device<T>> to
its driver-provided handler. It does so by building upon the newly-added
ARef<T> support in workqueue.rs in order to call into the driver
implementations for work_container_of and raw_get_work.

This is notably important for work items that need access to the drm
device, as it was not possible to enqueue work on a ARef<drm::Device<T>>
previously without failing the orphan rule.

The current implementation needs T::Data to live inline with drm::Device in
order for work_container_of to function. This restriction is already
captured by the trait bounds. Drivers that need to share their ownership of
T::Data may trivially get around this:

// Lives inline in drm::Device
struct DataWrapper {
  work: ...,
  // Heap-allocated, shared ownership.
  data: Arc<DriverData>,
}

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-2-f59729b812aa@collabora.com
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
rust/kernel/drm/device.rs