]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpu: nova-core: register: remove `try_` accessors for relative registers
authorAlexandre Courbot <acourbot@nvidia.com>
Fri, 18 Jul 2025 07:26:11 +0000 (16:26 +0900)
committerAlexandre Courbot <acourbot@nvidia.com>
Fri, 15 Aug 2025 03:02:55 +0000 (12:02 +0900)
Relative registers are always accessed using a literal base, meaning
their validity can always be checked at compile-time. Thus remove the
`try_` accessors that have no purpose.

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://lore.kernel.org/r/20250718-nova-regs-v2-6-7b6a762aa1cd@nvidia.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
drivers/gpu/nova-core/regs/macros.rs

index 44e2a12dce52ef4b9e2024b2f9b54a9599dfd96f..0567b3aae4d20d08c3ce87f601764801b10c39f6 100644 (file)
@@ -57,9 +57,7 @@
 /// definition, or the field getter and setter methods they are attached to.
 ///
 /// Putting a `+` before the address of the register makes it relative to a base: the `read` and
-/// `write` methods take a `base` argument that is added to the specified address before access,
-/// and `try_read` and `try_write` methods are also created, allowing access with offsets unknown
-/// at compile-time:
+/// `write` methods take a `base` argument that is added to the specified address before access:
 ///
 /// ```no_run
 /// register!(CPU_CTL @ +0x0000010, "CPU core control" {
@@ -386,40 +384,6 @@ macro_rules! register {
                 let reg = f(Self::read(io, base));
                 reg.write(io, base);
             }
-
-            #[inline]
-            pub(crate) fn try_read<const SIZE: usize, T>(
-                io: &T,
-                base: usize,
-            ) -> ::kernel::error::Result<Self> where
-                T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
-            {
-                io.try_read32(base + $offset).map(Self)
-            }
-
-            #[inline]
-            pub(crate) fn try_write<const SIZE: usize, T>(
-                self,
-                io: &T,
-                base: usize,
-            ) -> ::kernel::error::Result<()> where
-                T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
-            {
-                io.try_write32(self.0, base + $offset)
-            }
-
-            #[inline]
-            pub(crate) fn try_alter<const SIZE: usize, T, F>(
-                io: &T,
-                base: usize,
-                f: F,
-            ) -> ::kernel::error::Result<()> where
-                T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
-                F: ::core::ops::FnOnce(Self) -> Self,
-            {
-                let reg = f(Self::try_read(io, base)?);
-                reg.try_write(io, base)
-            }
         }
     };
 }