rust: auxiliary: add Driver::unbind() callback

Add missing unbind() callback to auxiliary::Driver, since it will be
needed by drivers eventually (e.g. the Nova DRM driver).

Acked-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260107103511.570525-3-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

+17 -1
+17 -1
rust/kernel/auxiliary.rs
··· 87 87 // SAFETY: `remove_callback` is only ever called after a successful call to 88 88 // `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called 89 89 // and stored a `Pin<KBox<T>>`. 90 - drop(unsafe { adev.as_ref().drvdata_obtain::<T>() }); 90 + let data = unsafe { adev.as_ref().drvdata_obtain::<T>() }; 91 + 92 + T::unbind(adev, data.as_ref()); 91 93 } 92 94 } 93 95 ··· 189 187 /// 190 188 /// Called when an auxiliary device is matches a corresponding driver. 191 189 fn probe(dev: &Device<device::Core>, id_info: &Self::IdInfo) -> impl PinInit<Self, Error>; 190 + 191 + /// Auxiliary driver unbind. 192 + /// 193 + /// Called when a [`Device`] is unbound from its bound [`Driver`]. Implementing this callback 194 + /// is optional. 195 + /// 196 + /// This callback serves as a place for drivers to perform teardown operations that require a 197 + /// `&Device<Core>` or `&Device<Bound>` reference. For instance, drivers may try to perform I/O 198 + /// operations to gracefully tear down the device. 199 + /// 200 + /// Otherwise, release operations for driver resources should be performed in `Self::drop`. 201 + fn unbind(dev: &Device<device::Core>, this: Pin<&Self>) { 202 + let _ = (dev, this); 203 + } 192 204 } 193 205 194 206 /// The auxiliary device representation.