On Wed Sep 2, 2026 at 1:50 AM JST, Gary Guo wrote:
> Currently registers work for all untyped I/O regions, which is not ideal.
> It allows registers defined for device A to work for another device B and
> there is no safeguarding at all.
>
> All users of the `register!` macro know what type it will be operating on,
> and that type is consistent across the driver. Therefore, add a `base`
> parameter to `register!`.
>
> Currently this parameter is unused in the generated code; it will be used
> when all users of `register!` is converted to gain the parameter.
>
> Signed-off-by: Gary Guo <[email protected]>

Reviewed-by: Alexandre Courbot <[email protected]>

With one nittynit below.

> diff --git a/rust/macros/io/register.rs b/rust/macros/io/register.rs
> index 9b92c8099edd..851335792a46 100644
> --- a/rust/macros/io/register.rs
> +++ b/rust/macros/io/register.rs
> @@ -29,6 +29,7 @@
>  };
>  
>  mod kw {
> +    syn::custom_keyword!(base);
>      syn::custom_keyword!(stride);
>  }
>  
> @@ -152,22 +153,42 @@ fn parse(input: syn::parse::ParseStream<'_>) -> 
> Result<Self> {
>  }
>  
>  pub(crate) struct RegDef {
> +    #[allow(unused)]

Now that the field is used, this can go away (also generally I believe
we prefer to use `expect` to catch such cases).

Reply via email to