Re: [PATCH v3 1/4] rust: workqueue: add support for ARef<T>

From: Alice Ryhl

Date: Tue Mar 24 2026 - 07:04:58 EST


On Tue, Mar 24, 2026 at 12:27 AM Daniel Almeida
<daniel.almeida@xxxxxxxxxxxxx> wrote:
>
> Add support for the ARef<T> smart pointer. This allows an instance of
> ARef<T> to handle deferred work directly, which can be convenient or even
> necessary at times, depending on the specifics of the driver or subsystem.
>
> The implementation is similar to that of Arc<T>, and a subsequent patch
> will implement support for drm::Device as the first user. 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.
>
> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Acked-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Signed-off-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
> ---
> rust/kernel/workqueue.rs | 85 ++++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 79 insertions(+), 6 deletions(-)
>
> diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
> index 706e833e9702..6ae7f3fb3496 100644
> --- a/rust/kernel/workqueue.rs
> +++ b/rust/kernel/workqueue.rs
> @@ -192,9 +192,9 @@
> sync::Arc,
> sync::LockClassKey,
> time::Jiffies,
> - types::Opaque,
> + types::{ARef, AlwaysRefCounted, Opaque},

Should be imported from sync::aref instead. This is using the
deprecated path that we are working on removing.

Alice