Re: [PATCH v2 4/5] rust: io: add `register!` macro

From: Gary Guo

Date: Wed Jan 21 2026 - 09:44:10 EST


On Wed Jan 21, 2026 at 7:23 AM GMT, Alexandre Courbot wrote:
> Add a macro for defining hardware register types with I/O accessors.
>
> Each register field is represented as a `Bounded` of the appropriate bit
> width, ensuring field values are never silently truncated.
>
> Fields can optionally be converted to/from custom types, either fallibly
> or infallibly.
>
> The address of registers can be direct, relative, or indexed, supporting
> most of the patterns in which registers are arranged.
>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>

It looks like this is still based on the current Io impl. I think with Zhi's new
Io trait this will look quite different.

Best,
Gary

> ---
> rust/kernel/io.rs | 1 +
> rust/kernel/io/register.rs | 1198 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 1199 insertions(+)