summaryrefslogtreecommitdiffstats
path: root/rust/kernel/workqueue.rs
diff options
context:
space:
mode:
authorDaniel Almeida <daniel.almeida@collabora.com>2026-03-23 20:27:01 -0300
committerAlice Ryhl <aliceryhl@google.com>2026-03-26 13:08:48 +0000
commit332666484f06cd85ad382329f5b3165aa627e9f8 (patch)
treef996550af28c9f6c6ade3f7ea3c6474b1fe3d3de /rust/kernel/workqueue.rs
parent72a723df8decf70e04f799a6defda8bb62d41848 (diff)
downloadlinux-332666484f06cd85ad382329f5b3165aa627e9f8.tar.gz
linux-332666484f06cd85ad382329f5b3165aa627e9f8.zip
rust: workqueue: add delayed work support for ARef<T>
The preceding patches added support for ARef<T> work items. By the same token, add support for delayed work items too. The rationale is the same: it may be convenient or even necessary at times to implement HasDelayedWork directly on ARef<T>. A follow up patch will also implement support for drm::Device as the first user. 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-3-f59729b812aa@collabora.com Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Diffstat (limited to 'rust/kernel/workqueue.rs')
-rw-r--r--rust/kernel/workqueue.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
index 6ae7f3fb3496..4ee4ff567197 100644
--- a/rust/kernel/workqueue.rs
+++ b/rust/kernel/workqueue.rs
@@ -1007,6 +1007,17 @@ where
}
}
+// SAFETY: By the safety requirements of `HasDelayedWork`, the `work_struct` returned by methods in
+// `HasWork` provides a `work_struct` that is the `work` field of a `delayed_work`, and the rest of
+// the `delayed_work` has the same access rules as its `work` field.
+unsafe impl<T, const ID: u64> RawDelayedWorkItem<ID> for ARef<T>
+where
+ T: WorkItem<ID, Pointer = Self>,
+ T: HasDelayedWork<T, ID>,
+ T: AlwaysRefCounted,
+{
+}
+
/// Returns the system work queue (`system_wq`).
///
/// It is the one used by `schedule[_delayed]_work[_on]()`. Multi-CPU multi-threaded. There are