summaryrefslogtreecommitdiff
path: root/samples/rust/rust_debugfs.rs
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2026-05-25 22:20:58 +0200
committerDanilo Krummrich <dakr@kernel.org>2026-05-27 16:22:42 +0200
commit24799831d631239ff21ea1bf7feee832df48b81f (patch)
tree813ff3b318f319bcca01fbae76088e4d5e2c5707 /samples/rust/rust_debugfs.rs
parentde12e48a1be3e9edc0f8bc6e37bad8f7b6f32d54 (diff)
rust: device: make Core and CoreInternal lifetime-parameterized
Device<Core> references in probe callbacks are scoped to the callback, not the full binding duration. Add a lifetime parameter to Core and CoreInternal to accurately represent this in the type system. Suggested-by: Gary Guo <gary@garyguo.net> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Eliot Courtney <ecourtney@nvidia.com> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260525202921.124698-12-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'samples/rust/rust_debugfs.rs')
-rw-r--r--samples/rust/rust_debugfs.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/samples/rust/rust_debugfs.rs b/samples/rust/rust_debugfs.rs
index 478c4f693deb..37640ed33642 100644
--- a/samples/rust/rust_debugfs.rs
+++ b/samples/rust/rust_debugfs.rs
@@ -122,7 +122,7 @@ impl platform::Driver for RustDebugFs {
const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
fn probe(
- pdev: &platform::Device<Core>,
+ pdev: &platform::Device<Core<'_>>,
_info: Option<&Self::IdInfo>,
) -> impl PinInit<Self, Error> {
RustDebugFs::new(pdev).pin_chain(|this| {
@@ -147,7 +147,7 @@ impl RustDebugFs {
dir.read_write_file(c"pair", new_mutex!(Inner { x: 3, y: 10 }))
}
- fn new(pdev: &platform::Device<Core>) -> impl PinInit<Self, Error> + '_ {
+ fn new<'a>(pdev: &'a platform::Device<Core<'_>>) -> impl PinInit<Self, Error> + 'a {
let debugfs = Dir::new(c"sample_debugfs");
let dev = pdev.as_ref();