Re: [PATCH v2 11/16] rust: io: register: support fixed offset register without bitfield
From: Alexandre Courbot
Date: Wed Aug 12 2026 - 05:03:00 EST
On Thu Aug 6, 2026 at 1:35 AM JST, Gary Guo wrote:
> Add a rule to allow creating `IoLoc` in `regiser!()` using an existing type
typo: register
> and not create a bitfield. Add an example to demonstrate this for FIFO
> registers.
>
> This rule is also going to be used to create subregions for registers; the
> example of doing so will be added later when relative registers are
> removed.
>
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> rust/kernel/io/register.rs | 47 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/rust/kernel/io/register.rs b/rust/kernel/io/register.rs
> index dc800fc71172..49a61da106c7 100644
> --- a/rust/kernel/io/register.rs
> +++ b/rust/kernel/io/register.rs
> @@ -182,6 +182,23 @@ fn offset(self) -> usize {
> }
> }
>
> +#[doc(hidden)]
> +pub struct OffsetLoc<Base: ?Sized, T>(usize, PhantomData<(T, Base)>);
Even if the doc remains hidden, it would be nice to have a small `//`
comment for those reading the code.