[PATCH v2 05/19] gpu: nova-core: register: simplify @leaf_accessor rule

Daniel Almeida daniel.almeida at collabora.com
Fri Jul 25 16:53:00 UTC 2025



> On 18 Jul 2025, at 04:26, Alexandre Courbot <acourbot at nvidia.com> wrote:
> 
> The `$type` metavariable is not used in the @leaf_accessor rule, so
> remove it.
> 
> Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
> ---
> drivers/gpu/nova-core/regs/macros.rs | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs
> index dac02f8055e76da68e9a82133fa09a1e794252bc..37c7c454ba810447e1fe41231650e616e2f86eb8 100644
> --- a/drivers/gpu/nova-core/regs/macros.rs
> +++ b/drivers/gpu/nova-core/regs/macros.rs
> @@ -230,7 +230,7 @@ impl $name {
>             $(, $comment:literal)?;
>     ) => {
>         register!(
> -            @leaf_accessor $name $hi:$lo $field as bool
> +            @leaf_accessor $name $hi:$lo $field
>             { |f| <$into_type>::from(if f != 0 { true } else { false }) }
>             $into_type => $into_type $(, $comment)?;
>         );
> @@ -248,7 +248,7 @@ impl $name {
>         @field_accessor $name:ident $hi:tt:$lo:tt $field:ident as $type:tt ?=> $try_into_type:ty
>             $(, $comment:literal)?;
>     ) => {
> -        register!(@leaf_accessor $name $hi:$lo $field as $type
> +        register!(@leaf_accessor $name $hi:$lo $field
>             { |f| <$try_into_type>::try_from(f as $type) } $try_into_type =>
>             ::core::result::Result<
>                 $try_into_type,
> @@ -262,7 +262,7 @@ impl $name {
>         @field_accessor $name:ident $hi:tt:$lo:tt $field:ident as $type:tt => $into_type:ty
>             $(, $comment:literal)?;
>     ) => {
> -        register!(@leaf_accessor $name $hi:$lo $field as $type
> +        register!(@leaf_accessor $name $hi:$lo $field
>             { |f| <$into_type>::from(f as $type) } $into_type => $into_type $(, $comment)?;);
>     };
> 
> @@ -276,7 +276,7 @@ impl $name {
> 
>     // Generates the accessor methods for a single field.
>     (
> -        @leaf_accessor $name:ident $hi:tt:$lo:tt $field:ident as $type:ty
> +        @leaf_accessor $name:ident $hi:tt:$lo:tt $field:ident
>             { $process:expr } $to_type:ty => $res_type:ty $(, $comment:literal)?;
>     ) => {
>         ::kernel::macros::paste!(
> 
> -- 
> 2.50.1
> 
> 

Reviewed-by: Daniel Almeida <daniel.almeida at collabora.com>


More information about the dri-devel mailing list