Re: [PATCH v5 12/24] rust: pci: make Driver trait lifetime-parameterized
From: Gary Guo
Date: Wed May 27 2026 - 09:22:13 EST
On Mon May 25, 2026 at 9:20 PM BST, Danilo Krummrich wrote:
> Add a 'bound lifetime to the associated Data, changing type Data to type
> Data<'bound>.
>
> This allows the driver's bus device private data to capture the device /
> driver bound lifetime; device resources can be stored directly by
> reference rather than requiring Devres.
>
> The probe() and unbind() callbacks thus gain a 'bound lifetime parameter
> on the methods themselves; avoiding a global lifetime on the trait impl.
>
> Existing drivers set type Data<'bound> = Self, preserving the current
> behavior.
>
> Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> drivers/gpu/nova-core/driver.rs | 9 ++++++---
> rust/kernel/pci.rs | 28 +++++++++++++--------------
> samples/rust/rust_dma.rs | 7 +++++--
> samples/rust/rust_driver_auxiliary.rs | 7 +++++--
> samples/rust/rust_driver_pci.rs | 7 +++++--
> 5 files changed, 35 insertions(+), 23 deletions(-)