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

"Alexandre Courbot" <[email protected]> Tue, 21 Jul 2026 08:02:02 -0700
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Tue Jul 21, 2026 at 7:34 AM PDT, Gary Guo wrote:
> 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.

This is a fix rather than a new feature. Relative register bases should
have been captured as a path since the beginning.

I'll be glad to remove relative registers entirely if projections can
cover their use-case better, but I would not withhold a fix while a
replacement is not visible yet.