From: sashiko-bot@kernel.org
To: "Alexandre Courbot" <acourbot@nvidia.com>
Cc: dri-devel@lists.freedesktop.org, ojeda@kernel.org,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Danilo Krummrich" <dakr@kernel.org>
Subject: Re: [PATCH 5/8] rust: io: register: allow paths for relative register bases
Date: Tue, 21 Jul 2026 11:14:09 +0000 [thread overview]
Message-ID: <20260721111409.8EB801F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260721-registers_fix-v1-5-3711b2317e1f@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Deprecated `+` syntax fallback rule for relative register aliases incorrectly captures the alias offset as a `ty` fragment, causing a macro expansion error.
- [Low] Mixing the deprecated `+` syntax and the new `:` syntax within the same `register! { ... }` block results in a compilation error.
--
--- Patch [5]: [PATCH 5/8] rust: io: register: allow paths for relative register bases ---
commit 0d4940e7a464ea733ee8d4db86d88c71b931bf2d
Author: Alexandre Courbot <acourbot@nvidia.com>
rust: io: register: allow paths for relative register bases
This commit introduces Base: Offset and Base: Alias syntax in the register!
macro, parsing them as path fragments rather than ident. It temporarily
retains the deprecated + syntax fallback to allow in-tree users to be
converted incrementally in subsequent patches.
> diff --git a/rust/kernel/io/register.rs b/rust/kernel/io/register.rs
> --- a/rust/kernel/io/register.rs
> +++ b/rust/kernel/io/register.rs
> @@ -801,6 +801,26 @@ fn into_io_op(self) -> (FixedRegisterLoc<T>, T) {
> /// ```
> #[macro_export]
> macro_rules! register {
> + // Deprecated `+` syntax for relative registers and their aliases.
> + (
> + $(
> + $(#[$attr:meta])* $vis:vis $name:ident ($storage:ty)
> + $([ $size:expr $(, stride = $stride:expr)? ])?
> + $(@ $($base:ident +)? $offset:literal)?
> + $(=> $alias:ident $(+ $alias_offset:ty)? $([$alias_idx:expr])? )?
^^^
[Severity: Low]
Does capturing the alias offset as a ty fragment here break the backward
compatibility?
When this is forwarded to the internal rule:
@reg $(#[$attr])* $vis $name ($storage) => $base:path : $alias:path
a parsed ty fragment cannot be matched by a path fragment specifier in the
subsequent macro invocation. This seems to result in a "no rules expected the
token in macro call" compilation error for any code still using the old
syntax.
[ ... ]
> // Entry point for the macro, allowing multiple registers to be defined in one call.
> // It matches all possible register declaration patterns to dispatch them to corresponding
> // `@reg` rule that defines a single register.
> @@ -808,8 +828,8 @@ macro_rules! register {
> $(
> $(#[$attr:meta])* $vis:vis $name:ident ($storage:ty)
> $([ $size:expr $(, stride = $stride:expr)? ])?
> - $(@ $($base:ident +)? $offset:literal)?
> - $(=> $alias:ident $(+ $alias_offset:path)? $([$alias_idx:expr])? )?
> + $(@ $($base:path :)? $offset:literal)?
> + $(=> $alias:path $(: $alias_offset:path)? $([$alias_idx:expr])? )?
> { $($fields:tt)* }
> )*
> ) => {
[Severity: Low]
Will this structure prevent mixing the old and new syntax within the same
register block?
Since both top-level macro arms use $( ... )* to match the entire contents
of the block, a block containing a mix of + and : syntax will fail both
matchers. This might cause compilation errors if users attempt to
incrementally migrate some, but not all, registers within a single
register block.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260721-registers_fix-v1-0-3711b2317e1f@nvidia.com?part=5
next prev parent reply other threads:[~2026-07-21 11:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 11:00 [PATCH 0/8] rust: io: register: allow paths for relative register bases Alexandre Courbot
2026-07-21 11:00 ` [PATCH 1/8] rust: io: register: dispatch fixed array shortcut internally Alexandre Courbot
2026-07-21 14:17 ` Gary Guo
2026-07-21 14:24 ` Gary Guo
2026-07-21 11:00 ` [PATCH 2/8] rust: io: register: remove unused rule arguments Alexandre Courbot
2026-07-21 11:00 ` [PATCH 3/8] rust: io: register: use path fragment for alias destination Alexandre Courbot
2026-07-21 11:07 ` sashiko-bot
2026-07-21 11:00 ` [PATCH 4/8] rust: io: register: use path fragment in relative internal rules Alexandre Courbot
2026-07-21 11:41 ` Alexandre Courbot
2026-07-21 11:00 ` [PATCH 5/8] rust: io: register: allow paths for relative register bases Alexandre Courbot
2026-07-21 11:14 ` sashiko-bot [this message]
2026-07-21 11:00 ` [PATCH 6/8] rust: io: register: use new relative base syntax in doc and examples Alexandre Courbot
2026-07-21 11:40 ` sashiko-bot
2026-07-21 11:00 ` [PATCH 7/8] gpu: nova-core: convert relative registers to new syntax Alexandre Courbot
2026-07-21 11:00 ` [PATCH 8/8] rust: io: register: remove deprecated relative register rule Alexandre Courbot
2026-07-21 14:34 ` [PATCH 0/8] rust: io: register: allow paths for relative register bases Gary Guo
2026-07-21 15:02 ` Alexandre Courbot
2026-07-21 15:06 ` Gary Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260721111409.8EB801F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.