mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
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>
This commit is contained in:
parent
91ae26b06a
commit
85aa5b16fe
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user