[PATCH 2/4] rust: devres: use `cast_pin_init` instead of manual reimplementation
Gary Guo <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Remove the manual type-casting which is already available as `cast_pin_init`. Signed-off-by: Gary Guo <[email protected]> --- rust/kernel/devres.rs | 6 +----- 1 file changed, 1 insertion(+), 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 @@ pub unsafe fn new<'a, E>( // 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)?)) } -- 2.54.0