gpu: nova-core: make formatting compatible with rust tree
Subsystems (4)
Alice Ryhl
maintainerPATCH 1/1 gpu: nova-core: make formatting compatible with rust tree
Commit 38b7cc448a5b ("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.
--- drivers/gpu/nova-core/gpu.rs | 5 ++--- drivers/gpu/nova-core/gsp/fw.rs | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/nova-core/gpu.rs +2 -3
@@ -227,13 +227,12 @@ fn try_from(boot42: regs::NV_PMC_BOOT_42) -> Result<Self> {impl fmt::Display for Spec {fn fmt (&self, f: &mut fmt::Formatter <'_>) -> fmt::Result { -write! ( - f, + f.write_fmt (fmt! ("Chipset: {}, Architecture: {:?}, Revision: {}" , self.chipset, self.chipset.arch (), self.revision - ) + )) } }
drivers/gpu/nova-core/gsp/fw.rs +2 -4
@@ -6,13 +6,11 @@// Alias to avoid repeating the version number with every use. use r570_144as bindings; -use core::{ - fmt, - ops::Range ,// -}; +use core::ops::Range ;use kernel::{ dma::CoherentAllocation , + fmt, prelude::*, ptr::{Alignable ,
---
base-commit: ce89e3e019f1ec4b11356f35feb8bd8c0f2c6bf7
change-id: 20251117-nova-fmt-rust-63cd29020d63
Best regards,
Signature · 1 line
Alice Ryhl <[email protected]>
Quoted 8 lines · Alice Ryhl
Commit
38b7cc448a5b("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.Signed-off-by Alice Ryhl <[email protected]>
Thanks, this solves the issue elegantly.
Quoted 8 lines · Alice Ryhl
Commit
38b7cc448a5b("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.Signed-off-by Alice Ryhl <[email protected]>
Applied to drm-rust-next.