From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299487; b=nRRMWiO+Ffa6R2L10Uw1YvM7SYo3H1Cl/Xp6/IgQ11V2KneiTQxOoQ0e0y2QbM6UWKaD tEeMHn6odbkD6/rgX9GhpMe10h+9dNwxmd1KTWDG5oSAc3VRDZeV0oMYQrN759CJoFoqR WEzHmNP1il8zhgPtUAoE6xTXgZ5/nMDlkUOPn5+Sx3xp9c3gF0+SjuZQ/2iUHbYp3wDUI SAvH/V8CI/+Xl/k/Ck5OQm7tqgDbTlBNeUAOmRYtyI0GFaMfnmDnORiSU/23lHkcds4of 55YRSLem/CTITAOFmSZojCG6GxVyfX7E6Gm9dogjE1S73WI7/gSXNjlf+VSQG9/ABMQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299487; 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=C6L/l8OLYFXxOLTBD1/NLFDf7kkfSVj3Bh8mJUBUGdY=; b=TQfiwv/7+j9gw/IH+lbKguI8iZ00jAEHUESst9j/fLKDUjdkMhRH2qtv9wG1Oi5IuQvE F99Q9AZuHFJvDA+Fzb6u3NGdKScStEzTEgVtXzH0zRRQyepf9cHQbINTKs8R3/0BO4t4L cVD8a236l4uWhoCQR8AMElwMNdNbRO3mZFNFLKoIGwrHMFoQJWkKW+RTaPB6SXbGaVExX 1HK4zP3r/O8PQbTQaXieKdWQ3kfVDGFXu5EgMs72ksBE4XOX98IVQ4Rd1nM6n0kFFXfg8 kQEFheLnjxsGvrZu/hgxpoPYEQWAaQf4ErPBm14JkOBCM2Xp73iqt57tvyyEOfBux0g== 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=Os7Y8j7m; arc=none smtp.remote-ip=100.103.45.18 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 56274606DC8F; Thu, 3 Dec 2026 12:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Os7Y8j7m Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24B641F0089F; Thu, 3 Dec 2026 12:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796299486; bh=C6L/l8OLYFXxOLTBD1/NLFDf7kkfSVj3Bh8mJUBUGdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Os7Y8j7mQ89HHO6QfoYDFl3GBlXMGvvjbPN3sl+edH7YMO/CwMXMvZk03ymW0W/OI obirJHosgNC2oItEBlLtnAwbR7aCcv/LPt2vi+BF/VqFysDs2AwXFLfphr5fnpCo2Q myexlfHehDiE5DDMW4eyuGEoJLY8YVvqCRSw06ZSx4dwWA20zK6N8cYfBjaz+jotli 4N9BHql/nAhJoWNGkQY2d04RmnzNTUN8raUSm3qvV4tEqleb26CQljdlmEgakiC3TV VH8BU1V8H3nHkxbfUdS8wS6so3DycOcQ/+7qCxXYeykBuxjPoacXhoCVyAn8KP6yBr RAiEwPGeOv3qg== From: Leon Romanovsky To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Dmitry Torokhov , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Johannes Berg , Jonathan Corbet , Shuah Khan , Randy Dunlap , Bjorn Helgaas , "Joerg Roedel (AMD)" , Suravee Suthikulpanit , Vasant Hegde , Will Deacon , Robin Murphy , David Woodhouse , Lu Baolu , Johan Hovold , Eric Dumazet , Marcel Holtmann , Luiz Augusto von Dentz , Nipun Gupta , Nikhil Agarwal , Pieter Jansen van Vuuren , Chris Lu , Mans Rullgard , Alan Stern , Jaroslav Kysela , Takashi Iwai , Andrew Morton , Cornelia Huck , Andrew Morton , Jeff Garzik , "Rafael J. Wysocki" , Bart Van Assche , Alexander Duyck , Dan Williams , Lukas Wunner 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, linux-coco@lists.linux.dev, Alexey Kardashevskiy , Luiz Augusto von Dentz , Greg Kroah-Hartman , linux-sound@vger.kernel.org, Jason Gunthorpe Subject: [PATCH v5 15/33] driver core: Report deferred probes through sysfs drivers_probe Date: Thu, 3 Dec 2026 14:03:37 +0200 Message-ID: <20261203-device-trust-core-v5-15-485cc6eddd46@nvidia.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com> References: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com> X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.17-dev-d2b70 Content-Transfer-Encoding: 8bit From: Leon Romanovsky commit b8c5cec23d5c ("Driver core: udev triggered device-<>driver binding") introduced the concept of "Systems who want to control the driver binding with udev" can use the drivers_probe sysfs to trigger a driver bind based on the kernel's match list. If attaching the driver is deferred before its probe callback runs, userspace sees EINVAL and cannot tell it should try again, maybe after loading other drivers. Map that deferral to EAGAIN and add missed documentation for the drivers_probe sysfs. A deferral requested by the probe callback itself is still not reported. Fixes: b8c5cec23d5c ("Driver core: udev triggered device-<>driver binding") Signed-off-by: Leon Romanovsky --- Documentation/ABI/testing/sysfs-bus-drivers-probe | 14 ++++++++++++++ MAINTAINERS | 1 + drivers/base/bus.c | 9 +++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-drivers-probe b/Documentation/ABI/testing/sysfs-bus-drivers-probe new file mode 100644 index 000000000000..ed8828e55d6b --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-drivers-probe @@ -0,0 +1,14 @@ +What: /sys/bus/.../drivers_probe +Date: February 2007 +Contact: driver-core@lists.linux.dev +Description: + (WO) Writing a device name requests driver attachment on this + bus, even when drivers_autoprobe is disabled. A successful + write does not guarantee that a driver bound. The driver link + can appear before probe completes; a bind uevent signals + successful binding. + + EAGAIN means attachment was deferred before the driver's probe + callback, for example while a supplier or the device itself + is not ready. ENODEV means the device was not found. Other + attachment errors return EINVAL. diff --git a/MAINTAINERS b/MAINTAINERS index 93abbb315065..b726344362b4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8149,6 +8149,7 @@ M: Johan Hovold L: driver-core@lists.linux.dev S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git +F: Documentation/ABI/testing/sysfs-bus-drivers-probe F: Documentation/core-api/kobject.rst F: Documentation/driver-api/driver-model/ F: drivers/base/ diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 396097fdb316..ecff32c3704b 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -310,13 +310,18 @@ static ssize_t drivers_probe_store(const struct bus_type *bus, const char *buf, size_t count) { struct device *dev; - int err = -EINVAL; + int err; dev = bus_find_device_by_name(bus, NULL, buf); if (!dev) return -ENODEV; - if (bus_rescan_devices_helper(dev, NULL) == 0) + err = bus_rescan_devices_helper(dev, NULL); + if (!err) err = count; + else if (err == -EPROBE_DEFER) + err = -EAGAIN; + else + err = -EINVAL; put_device(dev); return err; } -- 2.56.1