Re: [PATCH 0/7] rust: treewide: remove driver unbind callbacks

From: Gary Guo

Date: Thu Nov 12 2026 - 04:52:53 EST


On Thu Nov 12, 2026 at 12:52 AM GMT, Danilo Krummrich wrote:
> The driver model uses native Rust lifetimes, allowing driver data to
> retain device resources and a bound device reference for use in its
> destructor. Separate teardown callbacks are therefore no longer needed.
>
> Remove unbind() from the PCI, platform, auxiliary, serdev and I2C driver
> traits, and disconnect() from the USB driver trait. Move the affected
> sample teardown into destructors and update the driver documentation.

unbind() has the `Device<Core>` state, which the destructor won't be able to
get. Are we sure we won't need it in the future?

Best,
Gary

>
> Danilo Krummrich (7):
> rust: pci: remove the unbind() callback
> rust: platform: remove the unbind() callback
> rust: auxiliary: remove the unbind() callback
> rust: serdev: remove the unbind() callback
> rust: i2c: remove the unbind() callback
> rust: usb: remove the disconnect() callback
> rust: driver: document teardown through destructors
>
> rust/kernel/auxiliary.rs | 34 ++++-----------------------
> rust/kernel/driver.rs | 18 ++++++---------
> rust/kernel/i2c.rs | 31 ++++---------------------
> rust/kernel/pci.rs | 34 ++++-----------------------
> rust/kernel/platform.rs | 34 ++++-----------------------
> rust/kernel/serdev.rs | 41 ++++-----------------------------
> rust/kernel/usb.rs | 36 +++++------------------------
> samples/rust/rust_driver_i2c.rs | 18 ++++++++++-----
> samples/rust/rust_driver_pci.rs | 7 ++----
> samples/rust/rust_driver_usb.rs | 11 +++++----
> samples/rust/rust_i2c_client.rs | 12 +++++-----
> 11 files changed, 59 insertions(+), 217 deletions(-)
>
>
> base-commit: de7625abe4e92f1fb0047ed5f163b2ecaba77e50