From nobody Fri Oct 2 10:07:49 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 D809B38F925; Sun, 2 Aug 2026 23:32:24 +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=1785713546; cv=none; b=FwA7enRCThVi9moOCnnnFM2xw7GgGtuAalhdJN/meW1z5eBh2Zij4OofaHX1Ir6KDFwxd2iDKxYv+4aaWsGftnQQ6xakHW9dCHyyd+/ylUWYoFW4LT/v1TMfI8dqLuURjR/+Q4b3K0cM3MX8mYfMRkxIIHH2R3Th3AVt1/S0idc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785713546; c=relaxed/simple; bh=btWmGqEZ8QceDr+T2z03WHRhyE02ky2StMGbf/dgUrc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dUs9xQL3dnqLf/vD5CTY2VTWqFob6641DRZk12Zu8RXHP9THtLqg0ex0ZlNjrxMai+yWjKWvhQJaarBneR5T7kMgzf80O8f8hUsvlnDWTKyn6ooEN+ePgI00H7YavWj+dwvmCzdcp4ikpZamOam/ZsKVlv4Z9O8DnMFImX8BHlA= 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=cfc4+Oym; 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="cfc4+Oym" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harman.com; i=@harman.com; q=dns/txt; s=CES-HARMAN1; t=1785713545; x=1817249545; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TAD/ToNq9HLEt7BxieHIzpKrFaLmv8RAYarwWiboUOo=; b=cfc4+OymnYIPODH+xvh45Jjg8jfCNZkXr3t8bjjaYCnU5eUYCL0JqyjP FwGUM6T01TOyOefsem1IXrWdgiIbkaEs7Iho7i3EoeNUmi4RDqllhLsWU WhKrxDRTjXX4Gt3SHuT0qyJW13biPjQT5gUYFl9eNO1LwQJbG5yNygVwr m6MhnUYgqhszeYDE/JSQEnP/6+cT/PJyJR8Gw3GPY78Qk8l0LYRMn7pfT EcFScCEoGyatsyvsG4PTbzbY6+MxBFRFukYnDe2c7zggg70HT7f7QG2Je YI7LGzHYNh4BIBWecYEFpxJeMr++3a3KBv4+QyuurENkDaU+OA9kWWho+ w==; X-CSE-ConnectionGUID: wjzAAacYRf6GRKZ1sEQx0A== X-CSE-MsgGUID: R/Ej/5QxQPyJhCneXeSjIA== X-IronPort-AV: E=McAfee;i="6800,10657,11863"; a="118025934" X-IronPort-AV: E=Sophos;i="6.25,201,1779163200"; d="scan'208";a="118025934" 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 esa1.hc5016-32.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2026 19:31:14 -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; Mon, 3 Aug 2026 05:01:11 +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; Mon, 3 Aug 2026 05:01:11 +0530 Received: by awsmblx423bs002.localdomain (Postfix, from userid 530975) id 6749880059; Sun, 2 Aug 2026 23:31:11 +0000 (UTC) From: Akshay Gujar To: CC: , , , , , Subject: [PATCH v6 1/3] driver core: add device_enumeration_failure_notify() helper Date: Sun, 2 Aug 2026 23:31:06 +0000 Message-ID: <20260802233108.70950-2-Akshay.Gujar@harman.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20260802233108.70950-1-Akshay.Gujar@harman.com> References: <20260802233108.70950-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 The emitting device and the identifier are separate arguments because the device being enumerated usually does not exist yet. The event is emitted from a device the bus driver has already registered, and the identifier names the port or slot that failed. Signed-off-by: Akshay Gujar --- drivers/base/core.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 37 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 4d026682944f2..af6901799df58 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3830,6 +3830,41 @@ int device_add(struct device *dev) } EXPORT_SYMBOL_GPL(device_add); =20 +/** + * device_enumeration_failure_notify - notify userspace of enumeration fai= lure + * @dev: device to emit the uevent from + * @failed_id: bus-specific identifier of the port or slot that failed to + * enumerate, e.g. the port device name for USB + * + * Emit a KOBJ_CHANGE uevent from @dev carrying + * DEVICE_ENUMERATION_FAILURE=3D@failed_id. + * + * Return: 0 on success, a negative error code otherwise. + * + * See Documentation/ABI/testing/sysfs-uevent for more details. + */ +int device_enumeration_failure_notify(struct device *dev, + const char *failed_id) +{ + char *envp[2] =3D { NULL, NULL }; + int ret; + + if (!failed_id || !*failed_id) + return -EINVAL; + + envp[0] =3D kasprintf(GFP_KERNEL, "DEVICE_ENUMERATION_FAILURE=3D%s", + failed_id); + + if (!envp[0]) + return -ENOMEM; + + ret =3D kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); + kfree(envp[0]); + + return ret; +} +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..7dc9b2316ea24 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 +int device_enumeration_failure_notify(struct device *dev, const char *fail= ed_id); + #endif /* _DEVICE_H_ */ --=20 2.19.0 From nobody Fri Oct 2 10:07:49 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 4AFFD33122A; Sun, 2 Aug 2026 23:32:24 +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=1785713545; cv=none; b=Rek8e3BYOciE3tEptocspmUClq5mgyznUlMblQRsJLTRwNZh8QM5hzm4RKIHjbzvuGC4VyOSUgD1GNuMIAJe7ONbOQwwRQs41/THBl9Y71DxLBMkZoeFIKtkcR4EuUXQ65EaEF1JUI5pWmet7Pg3SE/X/jp4EuSCjQDgW6qnTCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785713545; c=relaxed/simple; bh=bbxuJ6Ua5w0m6Lru2hj8S1WU1keC+8be1ZyXN4cLPoE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jiLNStlSrBlWE5cf7JUaYVbNCAaYfmrwf9vJuJ7tGbj3S3dMnBLD9fjUaYhJmJUeuYDXlMiNkOnNEZeBaISqdL+5g5NkdhGSL2cJPp6/Zn9wj3jM9VG8pcc73lKqH6QmwJbT6xjxMucSg+zBdZIeKSh9re5WNon4qepKCajZ+kk= 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=GNqq1OTF; 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="GNqq1OTF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harman.com; i=@harman.com; q=dns/txt; s=CES-HARMAN1; t=1785713544; x=1817249544; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VKGYXRaxFBGBBiNMuo+qEYq8pPvopM49W6MPT33y15c=; b=GNqq1OTFnsvTB8zeDb+Du7BQ0ZAySY7Sm3Ud84yqGs3xvcug08Uoh9yE qJ0mHEVwSuuCpgpxgV/YQzHyqtPoz6QBdrmKzjp2PMRbqk+F5M+5KvlDj sqCw4T8I3G25mu0RRa5wsEMnloFzQLUqe7kGQLTsuXzg9B/ocAjGZx5JB 7pafq5T4TtrDImess5xdKDhH1hRmRg8II9vh129wnbUTdIAzmWLGe1crV 7ndzDUXXM66WgxL/51rlJkSBFMZcSGaj06BeWCIJAwva++44h13eNz5C9 SBK1k89CQEzrZZycPdbCDfoxeaOsLt20Dg2ni32XfkBSokcEuPVky2t7z Q==; X-CSE-ConnectionGUID: 3uHEfVXNQYGZdHK0W2M7Fg== X-CSE-MsgGUID: ohypSOJAQm+FDY7bUOihXQ== X-IronPort-AV: E=McAfee;i="6800,10657,11863"; a="117645078" X-IronPort-AV: E=Sophos;i="6.25,201,1779163200"; d="scan'208";a="117645078" 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 esa5.hc5016-32.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2026 19:31:15 -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; Mon, 3 Aug 2026 05:01:12 +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; Mon, 3 Aug 2026 05:01:12 +0530 Received: by awsmblx423bs002.localdomain (Postfix, from userid 530975) id E5AEA80059; Sun, 2 Aug 2026 23:31:11 +0000 (UTC) From: Akshay Gujar To: CC: , , , , , Subject: [PATCH v6 2/3] Documentation: ABI: document DEVICE_ENUMERATION_FAILURE uevent Date: Sun, 2 Aug 2026 23:31:07 +0000 Message-ID: <20260802233108.70950-3-Akshay.Gujar@harman.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20260802233108.70950-1-Akshay.Gujar@harman.com> References: <20260802233108.70950-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 | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-uevent b/Documentation/ABI/tes= ting/sysfs-uevent index 0b6227706b35e..6ace99f99daa3 100644 --- a/Documentation/ABI/testing/sysfs-uevent +++ b/Documentation/ABI/testing/sysfs-uevent @@ -49,3 +49,40 @@ Description: =20 Users: udev, userspace tools generating synthetic uevents + +What: DEVICE_ENUMERATION_FAILURE +Date: August 2026 +KernelVersion: 7.3 +Description: + Some devices are detected as physically present but fail + to enumerate, for example due to protocol-level errors or + invalid responses. + + When this happens, a bus driver may emit a KOBJ_CHANGE + uevent containing: + + DEVICE_ENUMERATION_FAILURE=3D + + The value is a bus-specific identifier of the port or slot + on which enumeration failed, not the name of the device + that emitted the event. For USB this is the port device + name, e.g. "usb1-port1". + + Example (USB): + + ACTION=3Dchange + SUBSYSTEM=3Dusb + DEVTYPE=3Dusb_interface + DEVPATH=3D/devices/.../usb1/1-0:1.0 + DEVICE_ENUMERATION_FAILURE=3Dusb1-port1 + + The event is emitted from the hub interface that owns the + port, so DEVPATH refers to the interface. Appending the + identifier to DEVPATH gives the failing port: + + /sys/devices/.../usb1/1-0:1.0/usb1-port1/ + +Users: + udev, userspace tools monitoring device enumeration + failures + --=20 2.19.0 From nobody Fri Oct 2 10:07:49 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 6CCCD356751; Sun, 2 Aug 2026 23:32:26 +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=1785713549; cv=none; b=oYzMFNBz1KTB7TTcMzgdCXd/3zy3iyePnw4We3lEltzujXLF0JA3f/dMlzj1wHzkBxnXrylEZttO3q2IWwE9Tu34f3pW+LCHh24Nb6jQ/mfGCB/rIp+c0Yb4B4emxPX6IqnReoMsUrtWUelC9+M9c7V1r2uim/ADakcezfn79j8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785713549; c=relaxed/simple; bh=4przBRhh1cRZD7KStSGaXhl6zXz+0M25B9IiIkd2nfk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pqxgzd3vx/w0NW0mHq3tGDQ+X4boq4EXglpck6wVjwVXhEyr0QfY3OT5Uqkj0iqHMWyeHcgcJIPOUUvSYwTuGYr3Xq3WdSOOZ82+kok3Tgt1zO3SYCsFFn+hDEXLQu5DK3YiF98u7RvcWgsdS/AqoHSd1Qxpac6ZxN0V2gGYo2A= 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=ElFLmrO1; 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="ElFLmrO1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harman.com; i=@harman.com; q=dns/txt; s=CES-HARMAN1; t=1785713546; x=1817249546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xs7KEoQug94DNSAZiYnsFgZIMPypF3GOMUS39LPoXDA=; b=ElFLmrO1wgU+Q0zPAF5/Xk1S32PcRdNuS+36Njy/tqHRn7asIa9jfXuw 2T9Q3QYAoa8q1fskpT1vH4kM1unrxYTttKjULR45FIMSqdJKxEw3OM8by 8ZD3cxsajjKGOgHpntMa7Q6NqWXRq+c3OJVx710CcWZzHZSfk/QqAk1rf UhPWgmJFEqMI69R0SFWnECw0c1mlIye+zjEGD0sH/YkeKHb4+nY/peozk rDWDOt69D7VLEsl8z2wtT0vXg1fc8cvWXkDzp1rrCiZd4tWk77+F0CHbE PSPf4U2i8Xc3X8+fStpGUEgtERJYUHuWEYtKUuFAqeJh0nrJ76kzwHwjN w==; X-CSE-ConnectionGUID: wjzAAacYRf6GRKZ1sEQx0A== X-CSE-MsgGUID: zZ8mAfExR42fs8uJLe7GQw== X-IronPort-AV: E=McAfee;i="6800,10657,11863"; a="118025935" X-IronPort-AV: E=Sophos;i="6.25,201,1779163200"; d="scan'208";a="118025935" 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 esa1.hc5016-32.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2026 19:31:16 -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; Mon, 3 Aug 2026 05:01:12 +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; Mon, 3 Aug 2026 05:01:12 +0530 Received: by awsmblx423bs002.localdomain (Postfix, from userid 530975) id 6DEB680059; Sun, 2 Aug 2026 23:31:12 +0000 (UTC) From: Akshay Gujar To: CC: , , , , , Subject: [PATCH v6 3/3] usb: hub: send enumeration failure uevent Date: Sun, 2 Aug 2026 23:31:08 +0000 Message-ID: <20260802233108.70950-4-Akshay.Gujar@harman.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20260802233108.70950-1-Akshay.Gujar@harman.com> References: <20260802233108.70950-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" Emit a structured uevent when USB device enumeration fails in hub_port_connect(), supplementing the existing error log with a notification userspace can act on. The event is emitted from the port's parent, the hub interface, because usb_port devices have neither a bus nor a class and dev_uevent_filter() drops any uevent sent from them. The failing port is named in the payload. Signed-off-by: Akshay Gujar --- drivers/usb/core/hub.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 5262e11c12cd3..78275dd702ceb 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -5613,9 +5613,21 @@ 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) { + int ret; dev_err(&port_dev->dev, "unable to enumerate USB device\n"); + + /* usb_port has no bus or class, so uevents from it + * are dropped; emit from the hub interface instead. + */ + ret =3D device_enumeration_failure_notify(port_dev->dev.parent, + dev_name(&port_dev->dev)); + if (ret) + dev_warn(&port_dev->dev, + "failed to send enumeration failure uevent: %d\n", + ret); + } } =20 done: --=20 2.19.0