]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: io: make IoMem and ExclusiveIoMem lifetime-parameterized
authorDanilo Krummrich <dakr@kernel.org>
Mon, 25 May 2026 20:21:06 +0000 (22:21 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 27 May 2026 14:24:28 +0000 (16:24 +0200)
commit89f55d04c6028fa15800a4887faf51bdeebfa431
treeea3f89b1f6883e223e7c57be53ca77390975e772
parent8ea0b6d5bef5e4f4637964c3b2cf732d9bf4f408
rust: io: make IoMem and ExclusiveIoMem lifetime-parameterized

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@kernel.org>
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260525202921.124698-20-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/drm/tyr/driver.rs
drivers/pwm/pwm_th1520.rs
rust/kernel/io/mem.rs