mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 06:49:29 -04:00
gpu: nova-core: register: split @io rule into fixed and relative versions
We used the same @io rule with different patterns to define both the fixed and relative I/O accessors. This can be confusing as the matching rules are very similar. Since all call sites know which version they want to call, split @io into @io_fixed and @io_relative to remove any ambiguity. Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Link: https://lore.kernel.org/r/20250718-nova-regs-v2-13-7b6a762aa1cd@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This commit is contained in:
@@ -89,25 +89,25 @@ macro_rules! register {
|
||||
// Creates a register at a fixed offset of the MMIO space.
|
||||
($name:ident @ $offset:literal $(, $comment:literal)? { $($fields:tt)* } ) => {
|
||||
register!(@core $name $(, $comment)? { $($fields)* } );
|
||||
register!(@io $name @ $offset);
|
||||
register!(@io_fixed $name @ $offset);
|
||||
};
|
||||
|
||||
// Creates an alias register of fixed offset register `alias` with its own fields.
|
||||
($name:ident => $alias:ident $(, $comment:literal)? { $($fields:tt)* } ) => {
|
||||
register!(@core $name $(, $comment)? { $($fields)* } );
|
||||
register!(@io $name @ $alias::OFFSET);
|
||||
register!(@io_fixed $name @ $alias::OFFSET);
|
||||
};
|
||||
|
||||
// Creates a register at a relative offset from a base address.
|
||||
($name:ident @ + $offset:literal $(, $comment:literal)? { $($fields:tt)* } ) => {
|
||||
register!(@core $name $(, $comment)? { $($fields)* } );
|
||||
register!(@io $name @ + $offset);
|
||||
register!(@io_relative $name @ + $offset);
|
||||
};
|
||||
|
||||
// Creates an alias register of relative offset register `alias` with its own fields.
|
||||
($name:ident => + $alias:ident $(, $comment:literal)? { $($fields:tt)* } ) => {
|
||||
register!(@core $name $(, $comment)? { $($fields)* } );
|
||||
register!(@io $name @ + $alias::OFFSET);
|
||||
register!(@io_relative $name @ + $alias::OFFSET);
|
||||
};
|
||||
|
||||
// All rules below are helpers.
|
||||
@@ -342,7 +342,7 @@ fn default() -> Self {
|
||||
};
|
||||
|
||||
// Generates the IO accessors for a fixed offset register.
|
||||
(@io $name:ident @ $offset:expr) => {
|
||||
(@io_fixed $name:ident @ $offset:expr) => {
|
||||
#[allow(dead_code)]
|
||||
impl $name {
|
||||
pub(crate) const OFFSET: usize = $offset;
|
||||
@@ -380,7 +380,7 @@ pub(crate) fn alter<const SIZE: usize, T, F>(
|
||||
};
|
||||
|
||||
// Generates the IO accessors for a relative offset register.
|
||||
(@io $name:ident @ + $offset:literal) => {
|
||||
(@io_relative $name:ident @ + $offset:literal) => {
|
||||
#[allow(dead_code)]
|
||||
impl $name {
|
||||
pub(crate) const OFFSET: usize = $offset;
|
||||
|
||||
Reference in New Issue
Block a user