rust: driver: update module documentation for GAT-based Data type

Now that all bus driver traits use type Data<'bound>: 'bound, update the
illustrative driver trait in the module documentation to reflect the GAT
pattern and lifetime-parameterized callbacks.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260525202921.124698-18-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
Danilo Krummrich 2026-05-25 22:21:04 +02:00
parent 71e6b6a80b
commit d31a349a7f

View File

@ -18,7 +18,7 @@
//! type IdInfo: 'static;
//!
//! /// The type of the driver's bus device private data.
//! type Data: Send;
//! type Data<'bound>: Send + 'bound;
//!
//! /// The table of OF device ids supported by the driver.
//! const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = None;
@ -27,11 +27,16 @@
//! const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None;
//!
//! /// Driver probe.
//! fn probe(dev: &Device<device::Core<'_>>, id_info: &Self::IdInfo)
//! -> impl PinInit<Self::Data, Error>;
//! fn probe<'bound>(
//! dev: &'bound Device<device::Core<'_>>,
//! id_info: &'bound Self::IdInfo,
//! ) -> impl PinInit<Self::Data<'bound>, Error> + 'bound;
//!
//! /// Driver unbind (optional).
//! fn unbind(dev: &Device<device::Core<'_>>, this: Pin<&Self::Data>) {
//! fn unbind<'bound>(
//! dev: &'bound Device<device::Core<'_>>,
//! this: Pin<&Self::Data<'bound>>,
//! ) {
//! let _ = (dev, this);
//! }
//! }
@ -46,9 +51,10 @@
)]
#![cfg_attr(CONFIG_PCI, doc = "* [`pci::Driver`](kernel::pci::Driver)")]
//!
//! The `probe()` callback should return a `impl PinInit<Self::Data, Error>`, i.e. the driver's
//! private data. The bus abstraction should store the pointer in the corresponding bus device. The
//! generic [`Device`] infrastructure provides common helpers for this purpose on its
//! The `probe()` callback should return a
//! `impl PinInit<Self::Data<'bound>, Error>`, i.e. the driver's private data. The bus
//! abstraction should store the pointer in the corresponding bus device. The generic
//! [`Device`] infrastructure provides common helpers for this purpose on its
//! [`Device<CoreInternal>`] implementation.
//!
//! All driver callbacks should provide a reference to the driver's private data. Once the driver