Re: [PATCH v5 19/24] rust: io: make IoMem and ExclusiveIoMem lifetime-parameterized

From: Gary Guo

Date: Wed May 27 2026 - 09:37:08 EST


On Mon May 25, 2026 at 9:21 PM BST, Danilo Krummrich wrote:
> Add a lifetime parameter to IoMem<'a, SIZE> and ExclusiveIoMem<'a,
> SIZE>, storing a &'a Device<Bound> reference to tie the mapping to the
> device's lifetime.
>
> This mirrors the pci::Bar<'a, SIZE> design and enables drivers to hold
> I/O memory mappings directly in their HRT private data, tied to the
> device lifetime.
>
> IoRequest::iomap_* methods now return the mapping directly instead of
> wrapping it in Devres. Callers that need device-managed revocation can
> call the new into_devres() method.
>
> Acked-by: Uwe Kleine-König <ukleinek@xxxxxxxxxx>
> 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>

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

> ---
> drivers/gpu/drm/tyr/driver.rs | 4 +-
> drivers/pwm/pwm_th1520.rs | 4 +-
> rust/kernel/io/mem.rs | 103 +++++++++++++++++-----------------
> 3 files changed, 56 insertions(+), 55 deletions(-)