From nobody Sun Feb 8 17:43:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E071301037; Wed, 7 Jan 2026 10:35:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767782137; cv=none; b=gp0ZERn8CJ9sAKJ9uc4fUGUFeaSadZ4bjVHuTqVeFTdhCCQgGrIAojKnlCW08VTPTm8QdGhQbQRQBS59SUINpdgx8ctRmQoZodrEjZRmtLT/CvkNN4HfBdiyd7wZ5atl2FJ3uiYSOyOSXWhs+shZU2RGYyTDH732lJjPMUNQX9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767782137; c=relaxed/simple; bh=UrLC3ImC0rFV+2liGhx/jCiQxmj7gIB4UnCVUnC/S1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fdtn4WHdmPlw/bjMmZyO/mdp6H5mnzCh/N7syvbTf6NBIo6Xldlwn04BrOQApWL82Sr82b3SdknnlzwthLEifpnw26miyNIoUKA/tA7S/QZcPOsyspjIkmNbxaaxH6IbBEGWoTtVerbUYVH/GZYI6/SFiAihNrDmYOZfLcpaJB0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JSQ50ZwX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JSQ50ZwX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A74A9C4CEF7; Wed, 7 Jan 2026 10:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767782137; bh=UrLC3ImC0rFV+2liGhx/jCiQxmj7gIB4UnCVUnC/S1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSQ50ZwXMKZcLWiBQQtmKoFnSudxMxgQ9mNHoxA9dU/xiN9qTIqrDkBLbWPNXkKxz fuahCVkdHnmPljBGfVc+PkIG2Vyept8vzUaPl7Go+xta5cxde/azhgwn2JEak2Hom+ 1S0WV0pRfagA59n+Q8fvkdRgyUIzBjOId02IAO0+BbWF2FjGfrG4JLFRd+V1JIfxwa hwMhzlQ5K4psogXzeAO5aPYjDso4G1xi/NNIn2QkmXOlZIwC07jzYLcSsU6BbrK1qz DmUn0avEpXTNfG5wMIY3znKgX98gpykFvA+IlCb741n6RITWDGY//EXKwRNnjJeErs mh6CPdl0xZbfw== From: Danilo Krummrich To: gregkh@linuxfoundation.org, rafael@kernel.org, igor.korotin.linux@gmail.com, ojeda@kernel.org, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu, david.m.ertman@intel.com, ira.weiny@intel.com, leon@kernel.org, bhelgaas@google.com, kwilczynski@kernel.org, wsa+renesas@sang-engineering.com Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, linux-i2c@vger.kernel.org, Danilo Krummrich Subject: [PATCH 2/6] rust: auxiliary: add Driver::unbind() callback Date: Wed, 7 Jan 2026 11:35:01 +0100 Message-ID: <20260107103511.570525-3-dakr@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260107103511.570525-1-dakr@kernel.org> References: <20260107103511.570525-1-dakr@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add missing unbind() callback to auxiliary::Driver, since it will be needed by drivers eventually (e.g. the Nova DRM driver). Signed-off-by: Danilo Krummrich --- Strictly speaking, this is not a dependency, but without this patch the ma= in fix of this series leaves the remove() callback of the auxiliary bus abstraction with either dead code or quite some code removed; code that we would otherwise add back immediately afterwards. --- rust/kernel/auxiliary.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/rust/kernel/auxiliary.rs b/rust/kernel/auxiliary.rs index 56f3c180e8f6..6931f8a4267f 100644 --- a/rust/kernel/auxiliary.rs +++ b/rust/kernel/auxiliary.rs @@ -87,7 +87,9 @@ extern "C" fn remove_callback(adev: *mut bindings::auxili= ary_device) { // SAFETY: `remove_callback` is only ever called after a successfu= l call to // `probe_callback`, hence it's guaranteed that `Device::set_drvda= ta()` has been called // and stored a `Pin>`. - drop(unsafe { adev.as_ref().drvdata_obtain::() }); + let data =3D unsafe { adev.as_ref().drvdata_obtain::() }; + + T::unbind(adev, data.as_ref()); } } =20 @@ -187,6 +189,20 @@ pub trait Driver { /// /// Called when an auxiliary device is matches a corresponding driver. fn probe(dev: &Device, id_info: &Self::IdInfo) -> impl P= inInit; + + /// Auxiliary driver unbind. + /// + /// Called when a [`Device`] is unbound from its bound [`Driver`]. Imp= lementing this callback + /// is optional. + /// + /// This callback serves as a place for drivers to perform teardown op= erations that require a + /// `&Device` or `&Device` reference. For instance, drive= rs may try to perform I/O + /// operations to gracefully tear down the device. + /// + /// Otherwise, release operations for driver resources should be perfo= rmed in `Self::drop`. + fn unbind(dev: &Device, this: Pin<&Self>) { + let _ =3D (dev, this); + } } =20 /// The auxiliary device representation. --=20 2.52.0