Re: [PATCH v5 20/24] samples: rust: rust_driver_pci: use HRT lifetime for Bar
From: Gary Guo
Date: Wed May 27 2026 - 09:49:21 EST
On Mon May 25, 2026 at 9:21 PM BST, Danilo Krummrich wrote:
> Convert the sample driver to SampleDriver<'bound>, taking advantage of
> the lifetime-parameterized Driver trait.
>
> The driver struct holds &'bound pci::Device directly instead of
> ARef<pci::Device>, and pci::Bar<'bound> directly instead of
> Devres<pci::Bar>. This removes PinnedDrop, pin_init_scope, and runtime
> revocation checks on BAR access.
It looks like the original code doesn't need pin_init to begin with, so it's not
like the lifetime actually helps here, but it's still a good cleanup.
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
>
> Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
> Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> samples/rust/rust_driver_pci.rs | 89 +++++++++++++++------------------
> 1 file changed, 40 insertions(+), 49 deletions(-)