Re: [PATCH v5 13/24] rust: platform: make Driver trait lifetime-parameterized

From: Gary Guo

Date: Wed May 27 2026 - 09:22:42 EST


On Mon May 25, 2026 at 9:21 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.
>
> Acked-by: Uwe Kleine-König <ukleinek@xxxxxxxxxx>
> 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/cpufreq/rcpufreq_dt.rs | 10 +++++-----
> drivers/gpu/drm/tyr/driver.rs | 10 +++++-----
> drivers/pwm/pwm_th1520.rs | 10 +++++-----
> rust/kernel/cpufreq.rs | 10 +++++-----
> rust/kernel/io/mem.rs | 20 ++++++++++----------
> rust/kernel/platform.rs | 28 ++++++++++++++--------------
> samples/rust/rust_debugfs.rs | 10 +++++-----
> samples/rust/rust_driver_platform.rs | 10 +++++-----
> samples/rust/rust_i2c_client.rs | 15 +++++++++------
> samples/rust/rust_soc.rs | 10 +++++-----
> 10 files changed, 68 insertions(+), 65 deletions(-)