[PATCH v2 08/19] gpu: nova-core: register: fix documentation and indentation

Alexandre Courbot posted 19 patches 6 months, 3 weeks ago
[PATCH v2 08/19] gpu: nova-core: register: fix documentation and indentation
Posted by Alexandre Courbot 6 months, 3 weeks ago
Fix a few documentation inconsistencies, and harmonize indentation where
possible.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/regs/macros.rs | 34 +++++++++-------------------------
 1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs
index 4da897787c065e69657ce65327e3290af403a615..32fbd7e7deb9edeed91972a373a5a6ac7ce9db53 100644
--- a/drivers/gpu/nova-core/regs/macros.rs
+++ b/drivers/gpu/nova-core/regs/macros.rs
@@ -87,44 +87,28 @@
 /// providing its own `completed` field.
 macro_rules! register {
     // Creates a register at a fixed offset of the MMIO space.
-    (
-        $name:ident @ $offset:literal $(, $comment:literal)? {
-            $($fields:tt)*
-        }
-    ) => {
+    ($name:ident @ $offset:literal $(, $comment:literal)? { $($fields:tt)* } ) => {
         register!(@common $name $(, $comment)?);
         register!(@field_accessors $name { $($fields)* });
         register!(@io $name @ $offset);
     };
 
-    // Creates a alias register of fixed offset register `alias` with its own fields.
-    (
-        $name:ident => $alias:ident $(, $comment:literal)? {
-            $($fields:tt)*
-        }
-    ) => {
+    // Creates an alias register of fixed offset register `alias` with its own fields.
+    ($name:ident => $alias:ident $(, $comment:literal)? { $($fields:tt)* } ) => {
         register!(@common $name $(, $comment)?);
         register!(@field_accessors $name { $($fields)* });
         register!(@io $name @ $alias::OFFSET);
     };
 
     // Creates a register at a relative offset from a base address.
-    (
-        $name:ident @ + $offset:literal $(, $comment:literal)? {
-            $($fields:tt)*
-        }
-    ) => {
+    ($name:ident @ + $offset:literal $(, $comment:literal)? { $($fields:tt)* } ) => {
         register!(@common $name $(, $comment)?);
         register!(@field_accessors $name { $($fields)* });
         register!(@io $name @ + $offset);
     };
 
-    // Creates a alias register of relative offset register `alias` with its own fields.
-    (
-        $name:ident => + $alias:ident $(, $comment:literal)? {
-            $($fields:tt)*
-        }
-    ) => {
+    // Creates an alias register of relative offset register `alias` with its own fields.
+    ($name:ident => + $alias:ident $(, $comment:literal)? { $($fields:tt)* } ) => {
         register!(@common $name $(, $comment)?);
         register!(@field_accessors $name { $($fields)* });
         register!(@io $name @ + $alias::OFFSET);
@@ -259,7 +243,7 @@ impl $name {
             { |f| <$into_type>::from(f as $type) } $into_type => $into_type $(, $comment)?;);
     };
 
-    // Shortcut for fields defined as non-`bool` without the `=>` or `?=>` syntax.
+    // Shortcut for non-boolean fields defined without the `=>` or `?=>` syntax.
     (
         @field_accessor $name:ident $hi:tt:$lo:tt $field:ident as $type:tt
             $(, $comment:literal)?;
@@ -310,7 +294,7 @@ pub(crate) fn [<set_ $field>](mut self, value: $to_type) -> Self {
         );
     };
 
-    // Creates the IO accessors for a fixed offset register.
+    // Generates the IO accessors for a fixed offset register.
     (@io $name:ident @ $offset:expr) => {
         #[allow(dead_code)]
         impl $name {
@@ -344,7 +328,7 @@ pub(crate) fn alter<const SIZE: usize, T, F>(
         }
     };
 
-    // Create the IO accessors for a relative offset register.
+    // Generates the IO accessors for a relative offset register.
     (@io $name:ident @ + $offset:literal) => {
         #[allow(dead_code)]
         impl $name {

-- 
2.50.1
Re: [PATCH v2 08/19] gpu: nova-core: register: fix documentation and indentation
Posted by Daniel Almeida 6 months, 2 weeks ago

> On 18 Jul 2025, at 04:26, Alexandre Courbot <acourbot@nvidia.com> wrote:
> 
> Fix a few documentation inconsistencies, and harmonize indentation where
> possible.
> 
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> drivers/gpu/nova-core/regs/macros.rs | 34 +++++++++-------------------------
> 1 file changed, 9 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs
> index 4da897787c065e69657ce65327e3290af403a615..32fbd7e7deb9edeed91972a373a5a6ac7ce9db53 100644
> --- a/drivers/gpu/nova-core/regs/macros.rs
> +++ b/drivers/gpu/nova-core/regs/macros.rs
> @@ -87,44 +87,28 @@
> /// providing its own `completed` field.
> macro_rules! register {
>     // Creates a register at a fixed offset of the MMIO space.
> -    (
> -        $name:ident @ $offset:literal $(, $comment:literal)? {
> -            $($fields:tt)*
> -        }
> -    ) => {
> +    ($name:ident @ $offset:literal $(, $comment:literal)? { $($fields:tt)* } ) => {
>         register!(@common $name $(, $comment)?);
>         register!(@field_accessors $name { $($fields)* });
>         register!(@io $name @ $offset);
>     };
> 
> -    // Creates a alias register of fixed offset register `alias` with its own fields.
> -    (
> -        $name:ident => $alias:ident $(, $comment:literal)? {
> -            $($fields:tt)*
> -        }
> -    ) => {
> +    // Creates an alias register of fixed offset register `alias` with its own fields.
> +    ($name:ident => $alias:ident $(, $comment:literal)? { $($fields:tt)* } ) => {
>         register!(@common $name $(, $comment)?);
>         register!(@field_accessors $name { $($fields)* });
>         register!(@io $name @ $alias::OFFSET);
>     };
> 
>     // Creates a register at a relative offset from a base address.
> -    (
> -        $name:ident @ + $offset:literal $(, $comment:literal)? {
> -            $($fields:tt)*
> -        }
> -    ) => {
> +    ($name:ident @ + $offset:literal $(, $comment:literal)? { $($fields:tt)* } ) => {
>         register!(@common $name $(, $comment)?);
>         register!(@field_accessors $name { $($fields)* });
>         register!(@io $name @ + $offset);
>     };
> 
> -    // Creates a alias register of relative offset register `alias` with its own fields.
> -    (
> -        $name:ident => + $alias:ident $(, $comment:literal)? {
> -            $($fields:tt)*
> -        }
> -    ) => {
> +    // Creates an alias register of relative offset register `alias` with its own fields.
> +    ($name:ident => + $alias:ident $(, $comment:literal)? { $($fields:tt)* } ) => {
>         register!(@common $name $(, $comment)?);
>         register!(@field_accessors $name { $($fields)* });
>         register!(@io $name @ + $alias::OFFSET);
> @@ -259,7 +243,7 @@ impl $name {
>             { |f| <$into_type>::from(f as $type) } $into_type => $into_type $(, $comment)?;);
>     };
> 
> -    // Shortcut for fields defined as non-`bool` without the `=>` or `?=>` syntax.
> +    // Shortcut for non-boolean fields defined without the `=>` or `?=>` syntax.
>     (
>         @field_accessor $name:ident $hi:tt:$lo:tt $field:ident as $type:tt
>             $(, $comment:literal)?;
> @@ -310,7 +294,7 @@ pub(crate) fn [<set_ $field>](mut self, value: $to_type) -> Self {
>         );
>     };
> 
> -    // Creates the IO accessors for a fixed offset register.
> +    // Generates the IO accessors for a fixed offset register.
>     (@io $name:ident @ $offset:expr) => {
>         #[allow(dead_code)]
>         impl $name {
> @@ -344,7 +328,7 @@ pub(crate) fn alter<const SIZE: usize, T, F>(
>         }
>     };
> 
> -    // Create the IO accessors for a relative offset register.
> +    // Generates the IO accessors for a relative offset register.
>     (@io $name:ident @ + $offset:literal) => {
>         #[allow(dead_code)]
>         impl $name {
> 
> -- 
> 2.50.1
> 

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