From: John Hubbard Date: Fri, 14 Nov 2025 02:41:04 +0000 (-0800) Subject: gpu: nova-core: implement Display for Spec X-Git-Tag: v6.19-rc1~157^2~8^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38b7cc448a5b;p=thirdparty%2Fkernel%2Flinux.git gpu: nova-core: implement Display for Spec Implement Display for Spec. This simplifies the dev_info!() code for printing banners such as: NVIDIA (Chipset: GA104, Architecture: Ampere, Revision: a.1) Cc: Alexandre Courbot Cc: Danilo Krummrich Cc: Timur Tabi Reviewed-by: Joel Fernandes Signed-off-by: John Hubbard Signed-off-by: Alexandre Courbot Message-ID: <20251114024109.465136-2-jhubbard@nvidia.com> --- diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index 03dae437bc376..dfeba9d5d8f63 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -180,6 +180,18 @@ impl Spec { } } +impl fmt::Display for Spec { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "Chipset: {}, Architecture: {:?}, Revision: {}", + self.chipset, + self.chipset.arch(), + self.revision + ) + } +} + /// Structure holding the resources required to operate the GPU. #[pin_data] pub(crate) struct Gpu { @@ -206,13 +218,7 @@ impl Gpu { ) -> impl PinInit + 'a { try_pin_init!(Self { spec: Spec::new(bar).inspect(|spec| { - dev_info!( - pdev.as_ref(), - "NVIDIA (Chipset: {}, Architecture: {:?}, Revision: {})\n", - spec.chipset, - spec.chipset.arch(), - spec.revision - ); + dev_info!(pdev.as_ref(),"NVIDIA ({})\n", spec); })?, // We must wait for GFW_BOOT completion before doing any significant setup on the GPU.