diff options
| author | Gary Guo <gary@garyguo.net> | 2026-07-22 19:50:16 +0100 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-07-27 22:29:34 +0200 |
| commit | a1f1b3b478b45259a7b5472ea9ec1b48ef6b5cd6 (patch) | |
| tree | 886175feebdfc512ca91bbf8c6b3c585cf22a615 /rust/kernel | |
| parent | 1c2c8484b9de941a5363d880e92d8b00a73065b0 (diff) | |
rust: devres: use `cast_pin_init` instead of manual reimplementation
Remove the manual type-casting which is already available as
`cast_pin_init`.
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260722-merge-init-v1-2-d4594de76538@garyguo.net
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel')
| -rw-r--r-- | rust/kernel/devres.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs index ebb5c19e851e..aecc8906de2c 100644 --- a/rust/kernel/devres.rs +++ b/rust/kernel/devres.rs @@ -435,11 +435,7 @@ where // SAFETY: The caller guarantees the data is valid for the device's full bound scope. // Lifetimes do not affect layout, so F::Of<'a> and F::Of<'static> have identical // representation; casting the slot pointer is sound. - let data = unsafe { - pin_init::pin_init_from_closure::<F::Of<'static>, E>(move |slot| { - data.__pinned_init(slot.cast()) - }) - }; + let data = unsafe { pin_init::cast_pin_init(data) }; Ok(Self(Devres::new(dev, data)?)) } |
