Re: [PATCH v2 11/16] rust: io: register: support fixed offset register without bitfield

"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:
> 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 <[email protected]>
> ---
>  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.
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.