Re: [PATCH v2 15/16] rust: io: register: remove `Register` trait and cleanup macro

"Alexandre Courbot" <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Thu Aug 6, 2026 at 1:35 AM JST, Gary Guo wrote:
<...>
> @@ -601,11 +605,22 @@ macro_rules! register {
>          { $($fields:tt)* }
>          $($rest:tt)*
>      ) => {
> -        $crate::register!(@bitfield $(#[$attr])* $vis struct $name($storage) { $($fields)* });
> -        $crate::register!(@io_base $reg_base; $name
> -            @ $crate::register!(@offset $(@ $offset)? $(=> $alias $([$alias_idx])?)?)
> +        $crate::bitfield!(
> +            #[allow(non_camel_case_types)]
> +            $(#[$attr])* $vis struct $name($storage) { $($fields)* }
>          );
> -        $crate::register!(@io_fixed $(#[$attr])* $vis $name);
> +
> +        impl $crate::io::register::FixedRegister for $name {
> +            type Base = $reg_base;
> +
> +            const OFFSET: usize =
> +                $crate::register!(@offset $(@ $offset)? $(=> $alias $([$alias_idx])?)?);

Btw, are the bases properly checked when using aliases? It looks like we
are expecting the base type of the *current* register block instead of
the one of the alias, which if true could lead to inconsistencies.
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.