On Tue Feb 3, 2026 at 4:46 PM CET, Matthew Maurer wrote:
> 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 <[email protected]>
> ---
>  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

"Returns a pointer to the underlying `struct auxiliary_device`."

> +    ///
> +    /// Prefer to add bindings in the kernel crate for any use other than 
> calling driver-specific
> +    /// functions.

I'm not sure I understand the message of this comment, but I'd probably just
drop it, the above should be enough.

> +    pub fn as_raw(&self) -> *mut bindings::auxiliary_device {
>          self.0.get()
>      }

Reply via email to