Article View: linux.kernel.netdev
Article #11628[PATCH 06/17] PNP: Attach card devices through the driver core
From: Leon Romanovsky
Date: Thu, 05 Nov 2026 11:42
Date: Thu, 05 Nov 2026 11:42
60 lines
9631 bytes
9631 bytes
From: Leon Romanovsky <leonro@nvidia.com>
Card device requests probe the selected link driver before driver core can
perform admission and setup.
Use device_driver_attach() for the normal binding transaction. Keep the
card link owned by the enclosing card probe until the device is bound, so
probe cleanup and debug removal cannot free a link still in use by that
transaction.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/pnp/card.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index df5e3d3cbf6c0..9aaaa03d5ffa9 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -52,13 +52,17 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
static void card_remove(struct pnp_dev *dev)
{
- dev->card_link = NULL;
+ if (device_is_bound(&dev->dev))
+ dev->card_link = NULL;
}
static void card_remove_first(struct pnp_dev *dev)
{
struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver);
+ /* The card probe still owns its link until this device is bound. */
+ if (!device_is_bound(&dev->dev))
+ return;
if (!dev->card || !drv)
return;
if (drv->remove)
@@ -331,16 +335,12 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
found:
dev->card_link = clink;
- dev->dev.driver = &drv->link.driver;
- if (pnp_bus_type.probe(&dev->dev))
- goto err_out;
- if (device_bind_driver(&dev->dev))
+ if (device_driver_attach(&drv->link.driver, &dev->dev))
goto err_out;
return dev;
err_out:
- dev->dev.driver = NULL;
dev->card_link = NULL;
return NULL;
}
--
2.56.0
Technical Details
Message-ID:
<20261105-device-trust-core-v1-6-1e536825b4eb@nvidia.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357265-linux-kernel-netdev=dewy.ruReferences:
<20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357265-linux-kernel-netdev=dewy.ru From: leon@kernel.org (Leon Romanovsky) Newsgroups: linux.kernel.netdev Subject: [PATCH 06/17] PNP: Attach card devices through the driver core Date: Thu, 5 Nov 2026 13:42:19 +0200 Organization: Usenet Network Message-ID: <20261105-device-trust-core-v1-6-1e536825b4eb@nvidia.com> References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3627235"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:r/IAo4Hvhr6VRE2z9Ak13/hqtLo= sha256:mlejqgoq6Ddq0WgRGHnFUfMxUXEWFFz41CpblRWCl1Q= sha1:VmIknsukyCO05iFnyVG+4Fsxwro= sha256:+GquaD8BDJHRslqcMUTNGvxouBKvPdeQ6K4NsG1lAUc= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A152F112F41; Thu, 5 Nov 2026 14:49:25 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.301 X-Spam-Status: No, score=-2.301 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LxATL8c-w_ZZ; Thu, 5 Nov 2026 14:49:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-357265-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 9571A112F14; Thu, 5 Nov 2026 14:49:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id E50E42AF8A; Thu, 5 Nov 2026 11:43:51 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793878982; b=BrvWF/vLMnllqWxHpkpDrRR8O5RrqqSWqM21YUQ022HBCIvLZkasOUmA85cFIZJrGANy F4aVw8oBNVtwYLVK96rb023b6zEsi6y5mXqNaOvL065F/qzikszcjcs9hNUjElEwD0JUd YZITqkMirIgzg/B9vt60i69B4atOQHXJKdCPjpI8+bsPYSetYudHe1RMw/4F1vJCSWP5U MuA9RyOAy4TfBGR95yUXTLp6IgNukq+EgGuZYprtpRbYtL324gzWDon0WzkfAs6Ckh++j +OSv8y/DvVqWTfx3e0viOYpY9SdvfyONofHHoIRhvvaZYpOrAZEbjTsBti5+aTdducw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793878982; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Type:X-Mailer: Content-Transfer-Encoding; bh=Y/diz28OtqaYX4DdZb+JhCSN/xAyOePemSvH2IVI+oI=; b=w3fCzkbnlFgy1Bsp5PoRn7MwurafUlyyX0b9YpZFPKIv/oQpIhIaXUmExiGMySNzUkTF Iu4riCI2eKYYk6Ut3wKyTtp0bedwOICBDgltoNNEeKsqfjye8G1k9k2VdTp4w5YYWuadi 53qhdf/D/s/zJ3MlHEI5nB4HONmXN/1+JaAEVA0IOHaxVr90Vh4q1bPK3PSwURb3YEXcw KmMKW34vzBVTqHs2DOoSpABYjJMBc5Buki/pRn6rjQkbDyyYJ7f9XlKSiSzJQKCyRyAjF qIJcg268lMQJN6MY9giO26hpIj8fEjcM1RREiUnx+7DqIzOpEhIUQPXOoWzkXUU0C3w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WbL5QjYs; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D055B606D831; Thu, 5 Nov 2026 11:42:57 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WbL5QjYs X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793878977; b=u01Ky0WJrd7RieMb1IgZk+dAPmqPUStOtLerhuK2qwwpm0Uhnqe9uuQIvbKaswqUSYh+ 25JrEn1m2an9xf51FytUGwrrGrPWyORLC8L1FZTeB1ADKvt0TaU0+ikCE/WB2HZDGpukq ok1A9DAkyzaCNvRl3HMUTmYV/SAUGv+EUVukpECqKGurPyfHiIwkG2gUxJUvhO1Z/vCmg 9pDmZO/Dh8ukHEJoc7S1BpqLfcSglyJ2OEVRHPSpXJVuyjPgSfIFzsRviVSw9oXBmTTDv JDL65CbawsNzwFSbtw9X/heZT0vhmDojl5a6CiPX5bBp0Qk8eIilK4k4ZdmIVCVbeJQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793878977; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type:X-Mailer: Content-Transfer-Encoding; bh=Y/diz28OtqaYX4DdZb+JhCSN/xAyOePemSvH2IVI+oI=; b=dGyOQHr94Mdi2Qm7LFsvZhDEtuNo98cH4R00nA3PzCzEfgFEUIfNgYuARY8Im4fp/ToH QheJKeMOA0IDLk/lXG9U+e0DaumMIChA4M2jTVymDVIFjIzNKlR9ez8CC1UISq3QT8hb0 21DQauUUz00cVvVbuzFPZTIs4C41h5wD0pBn80UrGKG8sl3m+8oTnIrNYjeIrY4RNaW5u TFxj0IzfrKpnihV0uWW7v2xFQ5f6I2kzQYM1xDsi3wpaB8O3AW8Do7xyyMFcRIonFWpwa 3GlU3j8HDvasRYrbyODMlm925Qg2+ak8qJak60fkDk1D0UM7HQF4TLkFFXaHt2j4FJQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WbL5QjYs; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A884C606D830; Thu, 5 Nov 2026 11:42:56 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 425D71F00A15; Thu, 5 Nov 2026 11:42:55 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793878976; bh=Y/diz28OtqaYX4DdZb+JhCSN/xAyOePemSvH2IVI+oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WbL5QjYsFkg65r1u2G3TgevctJY75JgPBr4BQeGQMD/7QzqtkIWrbIB8hZGRT0mfw /kfVAiYZJu8K/qqQnLel87sKZgqwTFBI5uhJnqJsg9HJGz2xXyCHHqsy5pMzCyYUOA nXRvT8P29UgyOeBEE0eY6Km0xdBtugwoUUqc1uyUwYj3cCGJwZYddOkcTeqNb6ZzV9 748SmpPnmX+lnfiPSSwGHW6o11kAwCvZmoBqacXlE0V8Fms7gCltsiTTiyrfi4tIEh fF/Q8HZs6P/tuorrRu9e7N/eT7XRGR92gPVL1D6yFrgwtW2RGnfWcWaNT4pU7Pwsd9 LqiLwc4CO4n9g== X-Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, linux-input@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-acpi@vger.kernel.org, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux.dev, Jason Gunthorpe <jgg@ziepe.ca> X-Mailer: git-send-email 2.56.0 X-In-Reply-To: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Mailer: b4 0.15-dev-18f8f