summaryrefslogtreecommitdiff
path: root/rust/macros
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2026-09-01 17:50:39 +0100
committerDanilo Krummrich <dakr@kernel.org>2026-09-06 13:39:49 +0200
commita8ab43a1089e289b58d303a1c10d0f81284087e7 (patch)
treeb6403dc9c844464664accaa74e654f536fb79fba /rust/macros
parent631adefcac893728c278f4bd2c9634cfe3f35482 (diff)
downloadlinux-next-a8ab43a1089e289b58d303a1c10d0f81284087e7.tar.gz
linux-next-a8ab43a1089e289b58d303a1c10d0f81284087e7.zip
rust: io: register: remove `Register` trait and cleanup macro
With the removal of relative registers, there are only two type of registers left, fixed register and register arrays. There is not much benefit in having a common super trait for them anymore, thus remove it, and cleanup the macro rules associated with it. Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Tested-by: Alexandre Courbot <acourbot@nvidia.com> Link: https://patch.msgid.link/20260901-typed_register-v4-15-5552b1d59525@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/macros')
-rw-r--r--rust/macros/io/register.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/rust/macros/io/register.rs b/rust/macros/io/register.rs
index 500805aa6b23..5511b8e5b875 100644
--- a/rust/macros/io/register.rs
+++ b/rust/macros/io/register.rs
@@ -225,11 +225,6 @@ pub(crate) fn register(def: RegDef) -> Result<TokenStream> {
#[allow(non_camel_case_types)]
#(#attrs)* #vis struct #name(#storage) #args
);
-
- impl ::kernel::io::register::Register for #name {
- type Base = #base;
- const OFFSET: usize = #offset;
- }
));
}
@@ -245,7 +240,10 @@ pub(crate) fn register(def: RegDef) -> Result<TokenStream> {
))?,
None => outputs.extend(quote_spanned!(span =>
- impl ::kernel::io::register::FixedRegister for #name {}
+ impl ::kernel::io::register::FixedRegister for #name {
+ type Base = #base;
+ const OFFSET: usize = #offset;
+ }
#(#attrs)* #vis const #name: ::kernel::io::register::FixedRegisterLoc<#name> =
::kernel::io::register::FixedRegisterLoc::<#name>::new();
@@ -268,6 +266,8 @@ pub(crate) fn register(def: RegDef) -> Result<TokenStream> {
impl ::kernel::io::register::Array for #name {}
impl ::kernel::io::register::RegisterArray for #name {
+ type Base = #base;
+ const OFFSET: usize = #offset;
const SIZE: usize = #size;
const STRIDE: usize = #stride;
}