Re: [PATCH v3 13/16] gpu: nova-core: convert hshub0 from relative register to projection

[email protected]
Newsgroups org.kernel.vger.linux-pci,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Incorrect usage of `#[inline]` annotation in a driver crate.
- [Low] Imports within the `kernel::io` block are not alphabetically sorted.
--

--- Patch [13]: [PATCH v3 13/16] gpu: nova-core: convert hshub0 from relative register to projection ---
commit f28bbcca2d960a3571d5473146fa91faad20810e
Author: Gary Guo <[email protected]>
gpu: nova-core: convert hshub0 from relative register to projection

This commit converts the hshub0 relative access to use projection and a new
base, similar to previous conversions. 

> diff --git a/drivers/gpu/nova-core/fb/hal/gb100.rs b/drivers/gpu/nova-core/fb/hal/gb100.rs
> index d9e4d62ae6321..9fa0949396009 100644
> --- a/drivers/gpu/nova-core/fb/hal/gb100.rs
> +++ b/drivers/gpu/nova-core/fb/hal/gb100.rs
> @@ -5,11 +5,10 @@
>  
>  use kernel::{
>      io::{
> -        register::{
> -            RegisterBase,
> -            WithBase, //
> -        },
> -        Io, //
> +        io_project,
> +        register,
> +        Io,
> +        Mmio, //

[Severity: Low]
This isn't a bug, but should these imports be alphabetically sorted? 

The kernel vertical import style usually requires sorting items alphabetically,
so Io and Mmio would typically precede the lowercase entries.

[ ... ]

> @@ -31,17 +33,26 @@
>  
>  struct Gb100;
>  
> -impl RegisterBase<regs::Hshub0Base> for Gb100 {
> -    const BASE: usize = 0x0087_0000;
> +register! {
> +    base: NovaRegisters;
> +
> +    HSHUB0: regs::Hshub0Registers @ 0x0087_0000;
> +}
> +
> +#[inline]
> +fn hshub0(bar: Bar0<'_>) -> Mmio<'_, regs::Hshub0Registers> {

[Severity: Low]
This isn't a bug, but is the #[inline] annotation needed here? 

The Rust subsystem guidelines suggest reserving #[inline] for abstractions,
and specifically note that leaf crates like drivers are exempt from needing it.

> +    io_project!(bar, build: HSHUB0)
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.