[PATCH v8 16/16] bitfields RANGE doc - not great

Alexandre Courbot
2025-11-07T23:43:17Z

From: Alexandre Courbot <gnurou at gmail.com>

---
 drivers/gpu/nova-core/bitfield.rs | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/bitfield.rs
b/drivers/gpu/nova-core/bitfield.rs
index 16e143658c51..90c714ec08ac 100644
--- a/drivers/gpu/nova-core/bitfield.rs
+++ b/drivers/gpu/nova-core/bitfield.rs
@@ -249,7 +249,17 @@ impl $name {
             { $process:expr } $prim_type:tt $to_type:ty => $res_type:ty $(,
$comment:literal)?;
     ) => {
         ::kernel::macros::paste!(
+        // #[doc=::core::concat!(
+        //     "Inclusive range of the bits covered by the `",
+        //     ::core::stringify!($name),
+        //     "` field."
+        // )]
+        #[doc="Inclusive range of "]
+        #[doc=::core::stringify!($name)]
+        #[doc="foo"]
         const [<$field:upper _RANGE>]:
::core::ops::RangeInclusive<u8> = $lo..=$hi;
+
+        /// Mask of the bits making up this field.
         const [<$field:upper _MASK>]: $storage = {
             // Generate mask for shifting
             match ::core::mem::size_of::<$storage>() {
@@ -260,11 +270,13 @@ impl $name {
                 _ => ::kernel::build_error!("Unsupported storage type
size")
             }
         };
+
+        /// Shift to apply to a value to align it with the start of this field.
         const [<$field:upper _SHIFT>]: u32 = $lo;
         );

         $(
-        #[doc="Returns the value of this field:"]
+        /// Returns the value of this field:
         #[doc=$comment]
         )?
         #[inline(always)]
@@ -280,7 +292,7 @@ impl $name {

         ::kernel::macros::paste!(
         $(
-        #[doc="Sets the value of this field:"]
+        /// Sets the value of this field:
         #[doc=$comment]
         )?
         #[inline(always)]

--
2.51.2