Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: qcom: use IS_REACHABLE(CONFIG_USB) for hub speed lookup
@ 2026-12-04  2:24 Pengpeng Hou
  2026-12-04  2:45 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-12-04  2:24 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman; +Cc: linux-usb, linux-arm-msm, Pengpeng Hou

The Qualcomm DWC3 suspend path needs the attached USB2 device speed when
selecting wake signals. The normal and legacy drivers both bypass the
host-side query if USB host support is modular.

Use IS_REACHABLE so modular host consumers can make the query without
introducing a built-in reference to a module.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: c06795f114a6 ("usb: dwc3: qcom: fix gadget-only builds")
Fixes: b958b03c82d2 ("usb: dwc3: qcom: Snapshot driver for backwards compatibilty")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built both dwc3-qcom.o and dwc3-qcom-legacy.o on x86-64 with GCC and
W=1, USB=m and USB_DWC3_QCOM=m. With the same configuration neither
object referenced usb_hub_find_child before the change; both referenced
it afterwards. No USB suspend or hardware test was run.

 drivers/usb/dwc3/dwc3-qcom-legacy.c | 2 +-
 drivers/usb/dwc3/dwc3-qcom.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom-legacy.c b/drivers/usb/dwc3/dwc3-qcom-legacy.c
index 189f5447aa786ce1e9ee89dd6efa215f3e956a5c..47a0f717fd53e49ecb966949b913b7c2fbaea59b 100644
--- a/drivers/usb/dwc3/dwc3-qcom-legacy.c
+++ b/drivers/usb/dwc3/dwc3-qcom-legacy.c
@@ -328,7 +328,7 @@ static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom, i
 	 */
 	hcd = platform_get_drvdata(dwc->xhci);
 
-#ifdef CONFIG_USB
+#if IS_REACHABLE(CONFIG_USB)
 	udev = usb_hub_find_child(hcd->self.root_hub, port_index + 1);
 #else
 	udev = NULL;
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index a2608416e04ecb8d3421421082ddbf7cae582de5..6501c00090c886b333599c0fee4dc919c16f2b68 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -240,7 +240,7 @@ static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom, i
 	 */
 	hcd = platform_get_drvdata(dwc->xhci);
 
-#ifdef CONFIG_USB
+#if IS_REACHABLE(CONFIG_USB)
 	udev = usb_hub_find_child(hcd->self.root_hub, port_index + 1);
 #else
 	udev = NULL;

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  2:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  2:24 [PATCH] usb: dwc3: qcom: use IS_REACHABLE(CONFIG_USB) for hub speed lookup Pengpeng Hou
2026-12-04  2:45 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox