]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpu: nova-core: add FbRange.len() and use it in boot.rs
authorJohn Hubbard <jhubbard@nvidia.com>
Tue, 10 Mar 2026 02:10:52 +0000 (19:10 -0700)
committerAlexandre Courbot <acourbot@nvidia.com>
Tue, 10 Mar 2026 11:13:46 +0000 (20:13 +0900)
A tiny simplification: now that FbLayout uses its own specific FbRange
type, add an FbRange.len() method, and use that to (very slightly)
simplify the calculation of Frts::frts_size initialization.

Suggested-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Link: https://patch.msgid.link/20260310021125.117855-3-jhubbard@nvidia.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
drivers/gpu/nova-core/fb.rs
drivers/gpu/nova-core/gsp/boot.rs

index 6fb804c118c609563bfe72ca9a36563499c45828..6536d0035cb13ef580bb68f177cceb16c47f8f41 100644 (file)
@@ -100,6 +100,12 @@ impl SysmemFlush {
 
 pub(crate) struct FbRange(Range<u64>);
 
+impl FbRange {
+    pub(crate) fn len(&self) -> u64 {
+        self.0.end - self.0.start
+    }
+}
+
 impl From<Range<u64>> for FbRange {
     fn from(range: Range<u64>) -> Self {
         Self(range)
@@ -118,7 +124,7 @@ impl fmt::Debug for FbRange {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // Use alternate format ({:#?}) to include size, compact format ({:?}) for just the range.
         if f.alternate() {
-            let size = self.0.end - self.0.start;
+            let size = self.len();
 
             if size < usize_as_u64(SZ_1M) {
                 let size_kib = size / usize_as_u64(SZ_1K);
index 9a00ddb922ac9d37db67e0abfacfcaa39f9a163d..d278ce620c244612f5403ef924e0431e577a256f 100644 (file)
@@ -73,7 +73,7 @@ impl super::Gsp {
             bios,
             FwsecCommand::Frts {
                 frts_addr: fb_layout.frts.start,
-                frts_size: fb_layout.frts.end - fb_layout.frts.start,
+                frts_size: fb_layout.frts.len(),
             },
         )?;