Re: [PATCH 0/8] rust: io: register: allow paths for relative register bases

From: Gary Guo

Date: Tue Jul 21 2026 - 10:39:24 EST


On Tue Jul 21, 2026 at 12:00 PM BST, Alexandre Courbot wrote:
> The register! macro currently accepts an identifier as the base of a
> relative register. This requires base types declared in other modules to
> be imported into the module containing the register declaration, rather
> than allowing a qualified path to be used directly, which is arbitrarily
> limiting.
>
> This series allows path to be used as relative register bases. Since a
> `path` fragment cannot be followed by `+` in declarative macros, the
> `Base + Offset` and `Base + Alias` forms are replaced with `Base:
> Offset` and `Base: Alias`, inducing a syntax change.
>
> The first two patches clean up the macro's internal dispatch and
> arguments in preparation for the change. Patches 3-6 gradually add
> support for the new syntax and update docs and examples, while
> preserving the old syntax. Patch 7 updates Nova to use the new syntax,
> and patch 8 removes support for the now unused old syntax.
>
> The series is structured this way so the Nova update and deprecated
> syntax removal can be merged separately, as otherwise the whole series
> would need to go through drm-rust.

I would like to avoid adding new features to relative registers as I aspire to
get rid of them entirely with typed registers.

I'll work on a prototype.

Best,
Gary

>
> Outside of the syntax update, no functional change is intended.
>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> ---
> Alexandre Courbot (8):
> rust: io: register: dispatch fixed array shortcut internally
> rust: io: register: remove unused rule arguments
> rust: io: register: use path fragment for alias destination
> rust: io: register: use path fragment in relative internal rules
> rust: io: register: allow paths for relative register bases
> rust: io: register: use new relative base syntax in doc and examples
> gpu: nova-core: convert relative registers to new syntax
> rust: io: register: remove deprecated relative register rule
>
> drivers/gpu/nova-core/regs.rs | 74 +++++++++++++++++++++---------------------
> rust/kernel/io/register.rs | 75 +++++++++++++++++++++----------------------
> 2 files changed, 74 insertions(+), 75 deletions(-)
> ---
> base-commit: 22e77d81d0a9ab3aee1c5538b3f2f8a66930bfa7
> change-id: 20260418-registers_fix-7a67ebef9ba0
>
> Best regards,
> --
> Alexandre Courbot <acourbot@xxxxxxxxxx>