From nobody Sat Jul 25 17:34:01 2026 Received: from esa.hc5016-32.iphmx.com (esa.hc5016-32.iphmx.com [207.54.87.100]) (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 09390429CF7; Wed, 15 Jul 2026 11:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.54.87.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784115749; cv=none; b=eQ/if7YRVLIZFCyj3HYnahSr3WbOylBKsSCTMim9x5aIUS29hPdGhLns58LXri2mq85ksnVOA58fldkdYrJYzfGXOTKjGnxYGt8Sms0oNCoQ4okF8exHwsonacF92F8cswjXoSzBbklGHVAo5H2kvj+yw1DmCpplmW9uw3pQoy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784115749; c=relaxed/simple; bh=UJVVeVyl4YQZsDiVjfInSyoglxJpsYizul6Y08XFjbk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nzaaopQCUToSqUs9FJXMkMGAeSNXZM9Xgpuy6aJcF+hoaI4b6ZVvWbaF4Nih2Er3l1RjlJnEQ8ezvS6tJ45qM5f4Ia2+s9YxYqOXqnHCOEDqXMyK6ijx22wA++NxdVVYXc4Jpysvn53xU8IzBXu1DxL4zVhRDtn38VDNkLtmqIY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=harman.com; spf=pass smtp.mailfrom=harman.com; dkim=pass (2048-bit key) header.d=harman.com header.i=@harman.com header.b=W44FiWfz; arc=none smtp.client-ip=207.54.87.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=harman.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=harman.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=harman.com header.i=@harman.com header.b="W44FiWfz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harman.com; i=@harman.com; q=dns/txt; s=CES-HARMAN1; t=1784115747; x=1815651747; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eMEDJh7vqsXsRSbuj2OoeYWWmVj5OHLR8CSQcRo473A=; b=W44FiWfz9WuS88WKcBJ/FOtQasDTKNb/W5NQ+NrAHbki895dkVvDboG+ Sc1pFNFUvP9Hfz66WM91ByRFnghYPu+GJrjsqns8DAS1cMVZj/U4/Cop+ UMWILpFEs+I6H4DP977PmGmgJir5Ux1sbzq/h3iFbnV93CoPoY7kz8WLF LEM4DmuAQQ1HEPpxoJK60nbkWn0HrvE+zvVveosrFWcUmC55aarODz4+4 g2fip4w/zWwB6PWv2PQeA2j99RKRNLtnwLGyzcLQSyiVczI15WIsgnROn +yO/eGygZCj8MbG3fenM4RRYfKb9XvMHrKYVa/VSeQfeQSwS46+qgkmX0 A==; X-CSE-ConnectionGUID: uwQLzCQjQJ6KjZwG7PA9OA== X-CSE-MsgGUID: DCxfyKALQ9GAJcUqkCfYqw== X-IronPort-AV: E=McAfee;i="6800,10657,11847"; a="121183033" X-IronPort-AV: E=Sophos;i="6.25,165,1779163200"; d="scan'208";a="121183033" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO INMDWSHYB10.ad.harman.com) ([199.27.113.4]) by esa8.hc5016-32.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2026 07:41:17 -0400 Received: from INMDWSHYB09.ad.harman.com (10.92.6.246) by INMDWSHYB10.ad.harman.com (10.92.6.249) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Wed, 15 Jul 2026 17:11:15 +0530 Received: from awsmblx423bs002.localdomain (10.63.34.68) by INMDWSHYB09.ad.harman.com (10.92.6.254) with Microsoft SMTP Server id 15.2.2562.43 via Frontend Transport; Wed, 15 Jul 2026 17:11:15 +0530 Received: by awsmblx423bs002.localdomain (Postfix, from userid 530975) id 200E28BC04; Wed, 15 Jul 2026 11:41:15 +0000 (UTC) From: Akshay Gujar To: CC: , , , , , Subject: [PATCH v5 1/3] driver core: add device_enumeration_failure_notify() helper Date: Wed, 15 Jul 2026 11:40:26 +0000 Message-ID: <20260715114028.3627807-2-Akshay.Gujar@harman.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20260715114028.3627807-1-Akshay.Gujar@harman.com> References: <20260715114028.3627807-1-Akshay.Gujar@harman.com> 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" Hotpluggable buses may detect that a device is physically present, but enumeration can fail early due to protocol-level errors. Such failures are currently only visible via kernel log messages, with no structured notification to userspace. Introduce device_enumeration_failure_notify(), a helper in the driver core that emits a KOBJ_CHANGE uevent with DEVICE_ENUMERATION_FAILURE=3D This helper is intended for use by bus drivers such as USB and PCI. Signed-off-by: Akshay Gujar --- drivers/base/core.c | 44 ++++++++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 46 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 4d026682944f2..6694a0c30f61b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3830,6 +3830,50 @@ int device_add(struct device *dev) } EXPORT_SYMBOL_GPL(device_add); =20 +/** + * device_enumeration_failure_notify - notify userspace of enumeration fai= lure + * @dev: device that failed to enumerate a connected child + * + * Emit a KOBJ_CHANGE uevent with + * DEVICE_ENUMERATION_FAILURE=3D. + * + * If @dev has not yet emitted its ADD uevent, the event may be sent + * from the parent device instead. + * + * The caller must hold a reference to @dev. + * + * See Documentation/ABI/testing/sysfs-uevent for more details. + */ +void device_enumeration_failure_notify(struct device *dev) +{ + char *envp[2] =3D { NULL, NULL }; + struct device *uevent_dev; + + if (!dev) + return; + + /* + * If enumeration fails before @dev has emitted its ADD uevent, the + * device may still be in an early state (e.g. without a bus or class + * assigned). Emit the event from the parent device instead, while + * including DEVICE_ENUMERATION_FAILURE=3D. + * + * The caller holds a reference to @dev, so dev->parent remains valid. + */ + uevent_dev =3D dev->kobj.state_add_uevent_sent ? dev : dev->parent; + if (!uevent_dev) + return; + + envp[0] =3D kasprintf(GFP_KERNEL, "DEVICE_ENUMERATION_FAILURE=3D%s", + dev_name(dev)); + if (!envp[0]) + return; + + kobject_uevent_env(&uevent_dev->kobj, KOBJ_CHANGE, envp); + kfree(envp[0]); +} +EXPORT_SYMBOL_GPL(device_enumeration_failure_notify); + /** * device_register - register a device with the system. * @dev: pointer to the device structure diff --git a/include/linux/device.h b/include/linux/device.h index 7b2baffdd2f55..39393c76c7ac7 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1394,4 +1394,6 @@ static inline bool device_link_test(const struct devi= ce_link *link, u32 flags) #define MODULE_ALIAS_CHARDEV_MAJOR(major) \ MODULE_ALIAS("char-major-" __stringify(major) "-*") =20 +void device_enumeration_failure_notify(struct device *dev); + #endif /* _DEVICE_H_ */ -- 2.19.0 From nobody Sat Jul 25 17:34:01 2026 Received: from esa.hc5016-32.iphmx.com (esa.hc5016-32.iphmx.com [207.54.81.235]) (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 C7E16370D6E; Wed, 15 Jul 2026 11:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.54.81.235 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784115690; cv=none; b=jBmVasEm1EgUEsyUbw2gUJG5TRKZhtQ9iRIZ6PdHaGxbVugbCsfwv5K8VV1VwDEOcyRbd0co77pOKwUFfgEoWo6rXpTsRoAh//qvWBsc4Ip77SbOTjMfEvujvKJBDCxDUMssP3tj2r86J9zK4JVKxfqmzbETmJV0UbhTAc8QmFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784115690; c=relaxed/simple; bh=CKs/rlBnd44Kf9iKW+e08vTczsr35CY0iB5WV1nsC1M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hLza7m0iZlQvVkUAgG+ADsecePjS7I6bpCgeEMG/gymNI8yb2ozZ/b55diZw5QZ9VeRBG7OVZG49kDCZxtme4pCNTY+w4SlvC2UMV4Dy2d38EeotctImrPhCVR6R9lxQgru5H2kj6c6fo6xwr9jgKkJiyGrgko/j+H60wwHwGo0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=harman.com; spf=pass smtp.mailfrom=harman.com; dkim=pass (2048-bit key) header.d=harman.com header.i=@harman.com header.b=TbfseFb4; arc=none smtp.client-ip=207.54.81.235 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=harman.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=harman.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=harman.com header.i=@harman.com header.b="TbfseFb4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harman.com; i=@harman.com; q=dns/txt; s=CES-HARMAN1; t=1784115688; x=1815651688; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0ILzIKff7RGFaBl5kVaXZtOSWZKbrGWQmGPtRvqAyKk=; b=TbfseFb4kq0qRR8yKy8DEFdUUO9/lS0Rml7SNEZCm6AiBLE7oJU7dyjX 033Wcwwkc7CUKv4+ZFuawmNqun9TRoi1qB0giRvl9JXvoKU+ADcUwy3YQ 3BNWf5Z3BsQZPNTsccatqDlBm3ZYNx4dB9dFO36rWpJa8J8LNWanvlF6k t6lQ7+zsRKkbSn08ltGNkzbcWYqwebVxagj58V7DRz3JjzGOohfMlAPCU r+nEXQf4SjWCK66HuVdYdBc/zXZ9dS2cJCAsD6fEJuJ9RNrO2Mcr04rrB P1W/B3uq++2TR8t7xOvsDpTtNZGjIaXUfO4rc88VdC6i0ndufYi4f8Y8D g==; X-CSE-ConnectionGUID: a46Qt3/5RzS3BPxb9gAGGw== X-CSE-MsgGUID: Qz1i5OdJRl2IdoU3SCmnrg== X-IronPort-AV: E=McAfee;i="6800,10657,11847"; a="116982821" X-IronPort-AV: E=Sophos;i="6.25,165,1779163200"; d="scan'208";a="116982821" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO INMDWSHYB09.ad.harman.com) ([199.27.113.4]) by esa1.hc5016-32.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2026 07:41:20 -0400 Received: from INMDWSHYB09.ad.harman.com (10.92.6.246) by INMDWSHYB09.ad.harman.com (10.92.6.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Wed, 15 Jul 2026 17:11:18 +0530 Received: from awsmblx423bs002.localdomain (10.63.34.68) by INMDWSHYB09.ad.harman.com (10.92.6.254) with Microsoft SMTP Server id 15.2.2562.43 via Frontend Transport; Wed, 15 Jul 2026 17:11:18 +0530 Received: by awsmblx423bs002.localdomain (Postfix, from userid 530975) id 20A7C8BC04; Wed, 15 Jul 2026 11:41:18 +0000 (UTC) From: Akshay Gujar To: CC: , , , , , Subject: [PATCH v5 2/3] Documentation: ABI: document DEVICE_ENUMERATION_FAILURE uevent Date: Wed, 15 Jul 2026 11:40:27 +0000 Message-ID: <20260715114028.3627807-3-Akshay.Gujar@harman.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20260715114028.3627807-1-Akshay.Gujar@harman.com> References: <20260715114028.3627807-1-Akshay.Gujar@harman.com> 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" Document the DEVICE_ENUMERATION_FAILURE environment variable emitted in KOBJ_CHANGE uevents when device enumeration fails. Signed-off-by: Akshay Gujar --- Documentation/ABI/testing/sysfs-uevent | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-uevent b/Documentation/ABI/tes= ting/sysfs-uevent index 0b6227706b35e..e362c34aa2ef6 100644 --- a/Documentation/ABI/testing/sysfs-uevent +++ b/Documentation/ABI/testing/sysfs-uevent @@ -49,3 +49,28 @@ Description: =20 Users: udev, userspace tools generating synthetic uevents + +What: DEVICE_ENUMERATION_FAILURE +Date: July 2026 +KernelVersion: 7.3 +Description: + Some devices may be detected but fail to enumerate + due to protocol-level errors or invalid responses. + + A KOBJ_CHANGE uevent includes the following environment + variable when this occurs: + + DEVICE_ENUMERATION_FAILURE=3D + + The value is the kernel device name of the device for + which enumeration failed, as returned by dev_name(). + + Example (USB): + + ACTION=3Dchange + SUBSYSTEM=3Dusb + DEVTYPE=3Dusb_interface + DEVICE_ENUMERATION_FAILURE=3Dusb1-port1 + +Users: + udev, userspace tools monitoring device enumeration failures \ No newline at end of file --=20 2.19.0 From nobody Sat Jul 25 17:34:01 2026 Received: from esa.hc5016-32.iphmx.com (esa.hc5016-32.iphmx.com [207.54.81.235]) (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 3A18843303A; Wed, 15 Jul 2026 11:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.54.81.235 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784115691; cv=none; b=Tvo8ZMNZTLbbW9UWFkOr9SMZbHtKJu8/ni5uL5XxZhqrZ8+sb9PUQIftLDl7lmvFhyYKqjkOY2XI3+GaeMOodYVfzoT3gNE688PFXsL9Lkey9R+Fa5I58eoGjbH1dIGB8Vq8XUf1fLOMPX6EScXFfoIePkJI8iIovL5AhtSnGnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784115691; c=relaxed/simple; bh=AR64wd+qK8vzwlAHFBRMwy2h9ggKDLoXEII4eKRoFuU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ST91vu326wwpZljaejJqkPUaqUgmIZMqHdVvv3Szzej8K/YBB7vba62lDZVVxMhBzhQk+O9SfAy1XFOxZ9F3ugVPHvEZMIuUDbPgNZpJZDCLcj8tYRinRHyQXh3dghME7wln7f/plCCnEGn/9rk3n2wvq9H5x6l+KoCim85YqJI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=harman.com; spf=pass smtp.mailfrom=harman.com; dkim=pass (2048-bit key) header.d=harman.com header.i=@harman.com header.b=OV3BmSjh; arc=none smtp.client-ip=207.54.81.235 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=harman.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=harman.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=harman.com header.i=@harman.com header.b="OV3BmSjh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harman.com; i=@harman.com; q=dns/txt; s=CES-HARMAN1; t=1784115690; x=1815651690; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nay+qMkcJEGrFs8hEEeT+3bHI5WJSCwwzsIvN6kXWww=; b=OV3BmSjh+IALc98KB6HhuueYkaljA7fmu2onqDBWH7ROuH9GM+kQa822 /kCiPo4qr4m1+nizbJLLBIgC4QwqSjso3Qz0TvWjh/Vp+GdHGOTk17MXX 5DOXKMTRKdKGjr+KOXajCRLGUeb0kvqWuv7cl6J7m85WzRyCqL6/xsydR uMjqF3tyj3zYy6cMNaek0H4nkHpwqIoYyvvhO6yQMKrr2GyGCa58CNly0 e4hd6wrXnPBndBQA8ag9hc9pOf/j2uXHmWRjcOhzM2gn61Eote1VS6J8R +vSOHYkc61eIPMT9yorJNZkvyaP/YMDkPtfoNIk+fbwfhbNYEHGUjc51M Q==; X-CSE-ConnectionGUID: a46Qt3/5RzS3BPxb9gAGGw== X-CSE-MsgGUID: d3baLR3sSm2f6OTJWsLkzQ== X-IronPort-AV: E=McAfee;i="6800,10657,11847"; a="116982825" X-IronPort-AV: E=Sophos;i="6.25,165,1779163200"; d="scan'208";a="116982825" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO INMDWSHYB09.ad.harman.com) ([199.27.113.4]) by esa1.hc5016-32.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2026 07:41:22 -0400 Received: from INMDWSHYB09.ad.harman.com (10.92.6.246) by INMDWSHYB09.ad.harman.com (10.92.6.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Wed, 15 Jul 2026 17:11:19 +0530 Received: from awsmblx423bs002.localdomain (10.63.34.68) by INMDWSHYB09.ad.harman.com (10.92.6.254) with Microsoft SMTP Server id 15.2.2562.43 via Frontend Transport; Wed, 15 Jul 2026 17:11:19 +0530 Received: by awsmblx423bs002.localdomain (Postfix, from userid 530975) id 0B97E8BC04; Wed, 15 Jul 2026 11:41:19 +0000 (UTC) From: Akshay Gujar To: CC: , , , , , Subject: [PATCH v5 3/3] usb: hub: send enumeration failure uevent Date: Wed, 15 Jul 2026 11:40:28 +0000 Message-ID: <20260715114028.3627807-4-Akshay.Gujar@harman.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20260715114028.3627807-1-Akshay.Gujar@harman.com> References: <20260715114028.3627807-1-Akshay.Gujar@harman.com> 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" Enumeration failure is currently only reported via kernel log. Emit a KOBJ_CHANGE uevent with DEVICE_ENUMERATION_FAILURE=3D when enumeration fails in hub_port_connect(). Signed-off-by: Akshay Gujar --- drivers/usb/core/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 5262e11c12cd3..2f2fd90aca66a 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -5613,9 +5613,11 @@ static void hub_port_connect(struct usb_hub *hub, in= t port1, u16 portstatus, if (hub->hdev->parent || !hcd->driver->port_handed_over || !(hcd->driver->port_handed_over)(hcd, port1)) { - if (status !=3D -ENOTCONN && status !=3D -ENODEV) + if (status !=3D -ENOTCONN && status !=3D -ENODEV) { dev_err(&port_dev->dev, "unable to enumerate USB device\n"); + device_enumeration_failure_notify(&port_dev->dev); + } } =20 done: --=20 2.19.0