Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://lore.kernel.org/r/20250713182737.64448-1-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

+5
+5
rust/kernel/devres.rs
··· 204 204 } == 0) 205 205 } 206 206 207 + /// Return a reference of the [`Device`] this [`Devres`] instance has been created with. 208 + pub fn device(&self) -> &Device { 209 + &self.dev 210 + } 211 + 207 212 /// Obtain `&'a T`, bypassing the [`Revocable`]. 208 213 /// 209 214 /// This method allows to directly obtain a `&'a T`, bypassing the [`Revocable`], by presenting