Re: [PATCH v2 3/4] rust: io: Implement Copy for RegisterArrayLoc
From: Gary Guo
Date: Fri Dec 04 2026 - 08:38:49 EST
On Fri Dec 4, 2026 at 12:21 PM GMT, Markus Probst wrote:
> This allows storing `RegisterArrayLoc` and using it multiple times.
>
> Derive is not possible, as it would introduce the unnecessary `T: Copy`
> bound.
>
> Signed-off-by: Markus Probst <markus.probst@xxxxxxxxx>
It's already in linux-next but I think it's via drm-rust-next tree.
Best,
Gary
> ---
> rust/kernel/io/register.rs | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/rust/kernel/io/register.rs b/rust/kernel/io/register.rs
> index c4f7be770dcb..6381c52bd397 100644
> --- a/rust/kernel/io/register.rs
> +++ b/rust/kernel/io/register.rs
> @@ -209,6 +209,14 @@ fn offset(self) -> usize {
> }
> }
>
> +impl<T: RegisterArray> Copy for RegisterArrayLoc<T> {}
> +
> +impl<T: RegisterArray> Clone for RegisterArrayLoc<T> {
> + fn clone(&self) -> Self {
> + *self
> + }
> +}
> +
> /// Trait providing location builders for [`RegisterArray`]s.
> pub trait Array {
> /// Returns the location of the register at position `idx`, with build-time validation.