lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250713182737.64448-1-dakr@kernel.org>
Date: Sun, 13 Jul 2025 20:26:53 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: gregkh@...uxfoundation.org,
	rafael@...nel.org,
	ojeda@...nel.org,
	alex.gaynor@...il.com,
	boqun.feng@...il.com,
	gary@...yguo.net,
	bjorn3_gh@...tonmail.com,
	lossin@...nel.org,
	a.hindborg@...nel.org,
	aliceryhl@...gle.com,
	tmgross@...ch.edu,
	daniel.almeida@...labora.com,
	m.wilczynski@...sung.com
Cc: rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Danilo Krummrich <dakr@...nel.org>
Subject: [PATCH 1/2] rust: devres: provide an accessor for the device

Provide an accessor for the Device a Devres instance has been created
with.

For instance, this is useful when registrations want to provide a
&Device<Bound> for a scope that is protected by Devres.

Suggested-by: Benno Lossin <lossin@...nel.org>
Signed-off-by: Danilo Krummrich <dakr@...nel.org>
---
 rust/kernel/devres.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs
index f43de3d77d61..a8a2d24cac24 100644
--- a/rust/kernel/devres.rs
+++ b/rust/kernel/devres.rs
@@ -204,6 +204,11 @@ fn remove_action(&self) -> bool {
         } == 0)
     }
 
+    /// Return a reference of the [`Device`] this [`Devres`] instance has been created with.
+    pub fn device(&self) -> &Device {
+        &self.dev
+    }
+
     /// Obtain `&'a T`, bypassing the [`Revocable`].
     ///
     /// This method allows to directly obtain a `&'a T`, bypassing the [`Revocable`], by presenting

base-commit: 3964d07dd821efe9680e90c51c86661a98e60a0f
-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ