[PATCH v2 09/19] gpu: nova-core: register: add missing doccomments for fixed registers I/O accessors

Daniel Almeida daniel.almeida at collabora.com
Fri Jul 25 17:06:19 UTC 2025



> On 18 Jul 2025, at 04:26, Alexandre Courbot <acourbot at nvidia.com> wrote:
> 
> Add the missing doccomments for these accessors, as having a bit of
> inline documentation is always helpful.
> 
> Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
> ---
> drivers/gpu/nova-core/regs/macros.rs | 4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs
> index 32fbd7e7deb9edeed91972a373a5a6ac7ce9db53..0a18a0d76b2265d3138f93ffc7c561b94bca3187 100644
> --- a/drivers/gpu/nova-core/regs/macros.rs
> +++ b/drivers/gpu/nova-core/regs/macros.rs
> @@ -300,6 +300,7 @@ pub(crate) fn [<set_ $field>](mut self, value: $to_type) -> Self {
>         impl $name {
>             pub(crate) const OFFSET: usize = $offset;
> 
> +            /// Read the register from its address in `io`.
>             #[inline]
>             pub(crate) fn read<const SIZE: usize, T>(io: &T) -> Self where
>                 T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
> @@ -307,6 +308,7 @@ pub(crate) fn read<const SIZE: usize, T>(io: &T) -> Self where
>                 Self(io.read32($offset))
>             }
> 
> +            /// Write the value contained in `self` to the register address in `io`.
>             #[inline]
>             pub(crate) fn write<const SIZE: usize, T>(self, io: &T) where
>                 T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
> @@ -314,6 +316,8 @@ pub(crate) fn write<const SIZE: usize, T>(self, io: &T) where
>                 io.write32(self.0, $offset)
>             }
> 
> +            /// Read the register from its address in `io` and run `f` on its value to obtain a new
> +            /// value to write back.

Ah, really neat!

>             #[inline]
>             pub(crate) fn alter<const SIZE: usize, T, F>(
>                 io: &T,
> 
> -- 
> 2.50.1
> 
> 

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



More information about the dri-devel mailing list