[PATCH v2 4/6] rust: auxiliary: Support accessing raw aux pointer
From: Matthew Maurer
Date: Tue Feb 03 2026 - 10:48:32 EST
While it's preferable to add bindings in the kernel crate rather than
using raw pointers where possible, access to the raw aux pointer is
required to pass it to C interfaces provided by a driver.
Signed-off-by: Matthew Maurer <mmaurer@xxxxxxxxxx>
---
rust/kernel/auxiliary.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/rust/kernel/auxiliary.rs b/rust/kernel/auxiliary.rs
index 93c0db1f66555c97ec7dc58825e97c47c0154e54..1a88277f0fd9ea5ff32cc534dfe5682009de94c2 100644
--- a/rust/kernel/auxiliary.rs
+++ b/rust/kernel/auxiliary.rs
@@ -237,7 +237,11 @@ pub struct Device<Ctx: device::DeviceContext = device::Normal>(
);
impl<Ctx: device::DeviceContext> Device<Ctx> {
- fn as_raw(&self) -> *mut bindings::auxiliary_device {
+ /// Returns the underlying auxiliary device
+ ///
+ /// Prefer to add bindings in the kernel crate for any use other than calling driver-specific
+ /// functions.
+ pub fn as_raw(&self) -> *mut bindings::auxiliary_device {
self.0.get()
}
--
2.53.0.rc2.204.g2597b5adb4-goog