[PATCH v2 2/4] rust: io: Add `RegisterArrayLoc::index`

From: Markus Probst

Date: Fri Dec 04 2026 - 07:22:15 EST


Add function to access index of `RegisterArrayLoc`.

Signed-off-by: Markus Probst <markus.probst@xxxxxxxxx>
---
rust/kernel/io/register.rs | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/rust/kernel/io/register.rs b/rust/kernel/io/register.rs
index b6513fa0f412..c4f7be770dcb 100644
--- a/rust/kernel/io/register.rs
+++ b/rust/kernel/io/register.rs
@@ -192,6 +192,11 @@ pub fn try_new(idx: usize) -> Option<Self> {
None
}
}
+
+ /// Returns the array position.
+ pub const fn index(self) -> usize {
+ self.0
+ }
}

impl<Base: ?Sized, T> IoLoc<Base, T> for RegisterArrayLoc<T>

--
2.56.1