Re: [PATCH v4 17/27] rust: pci: make Bar lifetime-parameterized
From: Alexandre Courbot
Date: Mon May 25 2026 - 07:16:09 EST
On Fri May 22, 2026 at 8:34 AM JST, Danilo Krummrich wrote:
> Convert pci::Bar<SIZE> to pci::Bar<'a, SIZE>, storing &'a Device<Bound>
> to tie the BAR mapping lifetime to the device.
>
> iomap_region_sized() now returns Result<Bar<'a, SIZE>> directly instead
> of impl PinInit<Devres<Bar<SIZE>>, Error>.
A small sentence explaining why that change happens here could be
helpful.
>
> Add Bar::into_devres() to consume the bar and register it as a
> device-managed resource, returning Devres<Bar<'static, SIZE>>. The
> lifetime is erased to 'static because Devres guarantees the bar does not
> actually outlive the device -- access is revoked on unbind.
>
> Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>