gpu: nova-core: make formatting compatible with rust tree

Commit 38b7cc448a ("gpu: nova-core: implement Display for Spec") in
drm-rust-next introduced some usage of the Display trait, but the
Display trait is being modified in the rust tree this cycle. Thus, to
avoid conflicts with the Rust tree, tweak how the formatting machinery
is used in a way where it works both with and without the changes in the
Rust tree.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20251117-nova-fmt-rust-v1-1-651ca28cd98f@google.com
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
Alice Ryhl 2025-11-17 10:39:17 +00:00
parent ce89e3e019
commit 77b686f688
2 changed files with 4 additions and 7 deletions

View File

@ -227,13 +227,12 @@ fn try_from(boot42: regs::NV_PMC_BOOT_42) -> Result<Self> {
impl fmt::Display for Spec { impl fmt::Display for Spec {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!( f.write_fmt(fmt!(
f,
"Chipset: {}, Architecture: {:?}, Revision: {}", "Chipset: {}, Architecture: {:?}, Revision: {}",
self.chipset, self.chipset,
self.chipset.arch(), self.chipset.arch(),
self.revision self.revision
) ))
} }
} }

View File

@ -6,13 +6,11 @@
// Alias to avoid repeating the version number with every use. // Alias to avoid repeating the version number with every use.
use r570_144 as bindings; use r570_144 as bindings;
use core::{ use core::ops::Range;
fmt,
ops::Range, //
};
use kernel::{ use kernel::{
dma::CoherentAllocation, dma::CoherentAllocation,
fmt,
prelude::*, prelude::*,
ptr::{ ptr::{
Alignable, Alignable,