]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: driver: decouple driver private data from driver type
authorDanilo Krummrich <dakr@kernel.org>
Mon, 25 May 2026 20:20:51 +0000 (22:20 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 27 May 2026 14:22:41 +0000 (16:22 +0200)
commit7fdffdda630ee61ae0e09ef8f1ace52bbf70e2b0
tree82bdea83290b72b76d053411b4f571a830172b30
parentc8a43666bade4683640dc835f92cd456d29cee55
rust: driver: decouple driver private data from driver type

Add a type Data<'bound> associated type to all bus driver traits,
decoupling the driver's bus device private data type from the driver
struct itself.

In the context of adding a 'bound lifetime, making this an associated
type has the advantage that it allows us to avoid a driver trait global
lifetime and it avoids the need for ForLt for bus device private data;
both of which make the subsequent implementation by buses much simpler.

All existing drivers and doc examples set type Data = Self to preserve
the current behavior.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260525202921.124698-5-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
22 files changed:
drivers/cpufreq/rcpufreq_dt.rs
drivers/gpu/drm/nova/driver.rs
drivers/gpu/drm/tyr/driver.rs
drivers/gpu/nova-core/driver.rs
drivers/pwm/pwm_th1520.rs
rust/kernel/auxiliary.rs
rust/kernel/cpufreq.rs
rust/kernel/driver.rs
rust/kernel/i2c.rs
rust/kernel/io/mem.rs
rust/kernel/pci.rs
rust/kernel/platform.rs
rust/kernel/usb.rs
samples/rust/rust_debugfs.rs
samples/rust/rust_dma.rs
samples/rust/rust_driver_auxiliary.rs
samples/rust/rust_driver_i2c.rs
samples/rust/rust_driver_pci.rs
samples/rust/rust_driver_platform.rs
samples/rust/rust_driver_usb.rs
samples/rust/rust_i2c_client.rs
samples/rust/rust_soc.rs