[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DE2D56N69NP8.2X1SGEBDM92DG@kernel.org>
Date: Fri, 07 Nov 2025 10:42:48 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "John Hubbard" <jhubbard@...dia.com>
Cc: "Alexandre Courbot" <acourbot@...dia.com>, "Joel Fernandes"
<joelagnelf@...dia.com>, "Timur Tabi" <ttabi@...dia.com>, "Alistair Popple"
<apopple@...dia.com>, "Edwin Peer" <epeer@...dia.com>, "Zhi Wang"
<zhiw@...dia.com>, "David Airlie" <airlied@...il.com>, "Simona Vetter"
<simona@...ll.ch>, "Bjorn Helgaas" <bhelgaas@...gle.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
<lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Alice
Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
<nouveau@...ts.freedesktop.org>, <rust-for-linux@...r.kernel.org>, "LKML"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpu: nova-core: apply the one "use" item per line
policy
On Fri Nov 7, 2025 at 3:10 AM CET, John Hubbard wrote:
> As per [1], we need one "use" item per line, in order to reduce merge
> conflicts. Furthermore, we need a trailing ", //" in order to tell
> rustfmt(1) to leave it alone.
>
> This does that for the entire nova-core driver.
>
> [1] https://docs.kernel.org/rust/coding-guidelines.html#imports
>
> Signed-off-by: John Hubbard <jhubbard@...dia.com>
Thanks for doing this!
Few nits below, I assume Alex will fix them up on apply, so no need to resend.
With those fixed,
Acked-by: Danilo Krummrich <dakr@...nel.org>
> diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
> index 27d9edab8347..53e718510568 100644
> --- a/drivers/gpu/nova-core/fb.rs
> +++ b/drivers/gpu/nova-core/fb.rs
> @@ -2,16 +2,24 @@
>
> use core::ops::Range;
>
> -use kernel::prelude::*;
> -use kernel::ptr::{Alignable, Alignment};
> -use kernel::sizes::*;
> -use kernel::sync::aref::ARef;
> -use kernel::{dev_warn, device};
> -
> -use crate::dma::DmaObject;
> -use crate::driver::Bar0;
> -use crate::gpu::Chipset;
> -use crate::regs;
> +use kernel::{
> + dev_warn,
Should be in prelude and hence can be dropped.
> + device,
> + prelude::*,
> + ptr::{
> + Alignable,
> + Alignment, //
> + },
> + sizes::*,
> + sync::aref::ARef, //
> +};
> +
> +use crate::{
> + dma::DmaObject,
> + driver::Bar0,
> + gpu::Chipset,
> + regs, //
> +};
<snip>
> diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs
> index 4179a74a2342..895309132ae0 100644
> --- a/drivers/gpu/nova-core/firmware.rs
> +++ b/drivers/gpu/nova-core/firmware.rs
> @@ -3,18 +3,24 @@
> //! Contains structures and functions dedicated to the parsing, building and patching of firmwares
> //! to be loaded into a given execution unit.
>
> -use core::marker::PhantomData;
> -use core::mem::size_of;
> -
> -use kernel::device;
> -use kernel::firmware;
> -use kernel::prelude::*;
> -use kernel::str::CString;
> -use kernel::transmute::FromBytes;
> -
> -use crate::dma::DmaObject;
> -use crate::falcon::FalconFirmware;
> -use crate::gpu;
> +use core::{
> + marker::PhantomData,
> + mem::size_of, //
Should be in prelude.
> +};
> +
> +use kernel::{
> + device,
> + firmware,
> + prelude::*,
> + str::CString,
> + transmute::FromBytes, //
> +};
> +
> +use crate::{
> + dma::DmaObject,
> + falcon::FalconFirmware,
> + gpu, //
> +};
>
> pub(crate) mod booter;
> pub(crate) mod fwsec;
> diff --git a/drivers/gpu/nova-core/firmware/booter.rs b/drivers/gpu/nova-core/firmware/booter.rs
> index b4ff1b17e4a0..4d2a6502a879 100644
> --- a/drivers/gpu/nova-core/firmware/booter.rs
> +++ b/drivers/gpu/nova-core/firmware/booter.rs
> @@ -4,20 +4,38 @@
> //! running on [`Sec2`], that is used on Turing/Ampere to load the GSP firmware into the GSP falcon
> //! (and optionally unload it through a separate firmware image).
>
> -use core::marker::PhantomData;
> -use core::mem::size_of;
> -use core::ops::Deref;
> -
> -use kernel::device;
> -use kernel::prelude::*;
> -use kernel::transmute::FromBytes;
> -
> -use crate::dma::DmaObject;
> -use crate::driver::Bar0;
> -use crate::falcon::sec2::Sec2;
> -use crate::falcon::{Falcon, FalconBromParams, FalconFirmware, FalconLoadParams, FalconLoadTarget};
> -use crate::firmware::{BinFirmware, FirmwareDmaObject, FirmwareSignature, Signed, Unsigned};
> -use crate::gpu::Chipset;
> +use core::{
> + marker::PhantomData,
> + mem::size_of,
Same here...
> + ops::Deref, //
> +};
> +
> +use kernel::{
> + device,
> + prelude::*,
> + transmute::FromBytes, //
> +};
> +
> +use crate::{
> + dma::DmaObject,
> + driver::Bar0,
> + falcon::{
> + sec2::Sec2,
> + Falcon,
> + FalconBromParams,
> + FalconFirmware,
> + FalconLoadParams,
> + FalconLoadTarget, //
> + },
> + firmware::{
> + BinFirmware,
> + FirmwareDmaObject,
> + FirmwareSignature,
> + Signed,
> + Unsigned, //
> + },
> + gpu::Chipset, //
> +};
<snip>
> diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
> index 9d182bffe8b4..de87efaf09f1 100644
> --- a/drivers/gpu/nova-core/gpu.rs
> +++ b/drivers/gpu/nova-core/gpu.rs
> @@ -1,13 +1,27 @@
> // SPDX-License-Identifier: GPL-2.0
>
> -use kernel::{device, devres::Devres, error::code::*, fmt, pci, prelude::*, sync::Arc};
> -
> -use crate::driver::Bar0;
> -use crate::falcon::{gsp::Gsp as GspFalcon, sec2::Sec2 as Sec2Falcon, Falcon};
> -use crate::fb::SysmemFlush;
> -use crate::gfw;
> -use crate::gsp::Gsp;
> -use crate::regs;
> +use kernel::{
> + device,
> + devres::Devres,
> + error::code::*,
That's also in prelude.
> + fmt,
> + pci,
> + prelude::*,
> + sync::Arc, //
> +};
> +
> +use crate::{
> + driver::Bar0,
> + falcon::{
> + gsp::Gsp as GspFalcon,
> + sec2::Sec2 as Sec2Falcon,
> + Falcon, //
> + },
> + fb::SysmemFlush,
> + gfw,
> + gsp::Gsp,
> + regs, //
> +};
<snip>
> diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
> index aec9166ffb45..b4711126038b 100644
> --- a/drivers/gpu/nova-core/vbios.rs
> +++ b/drivers/gpu/nova-core/vbios.rs
> @@ -2,16 +2,27 @@
>
> //! VBIOS extraction and parsing.
>
> -use crate::driver::Bar0;
> -use crate::firmware::fwsec::Bcrt30Rsa3kSignature;
> -use crate::firmware::FalconUCodeDescV3;
> use core::convert::TryFrom;
> -use kernel::device;
> -use kernel::error::Result;
> -use kernel::prelude::*;
> -use kernel::ptr::{Alignable, Alignment};
> -use kernel::transmute::FromBytes;
> -use kernel::types::ARef;
> +
> +use kernel::{
> + device,
> + error::Result,
prelude
> + prelude::*,
> + ptr::{
> + Alignable,
> + Alignment, //
> + },
> + transmute::FromBytes,
> + types::ARef, //
> +};
> +
> +use crate::{
> + driver::Bar0,
> + firmware::{
> + fwsec::Bcrt30Rsa3kSignature,
> + FalconUCodeDescV3, //
> + }, //
> +};
Powered by blists - more mailing lists