Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <hppiscas@163.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: dwc3: qcom: use IS_REACHABLE(CONFIG_USB) for hub speed lookup
Date: Fri, 04 Dec 2026 02:45:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-249004@kernel.org> (raw)
In-Reply-To: <179635104069.74470.7311513117268429199@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] usb: dwc3: qcom: unnecessary usbcore dependency in gadget-only
  builds
--

commit 8d368bc1212d1c6dd44f3c214755c23434636cce
Author: Pengpeng Hou <hppiscas@163.com>

usb: dwc3: qcom: use IS_REACHABLE(CONFIG_USB) for hub speed lookup

This commit replaces #ifdef CONFIG_USB with #if IS_REACHABLE(CONFIG_USB)
around the usb_hub_find_child() call in dwc3_qcom_read_usb2_speed() in
both the normal and legacy Qualcomm DWC3 glue drivers.

> diff --git a/drivers/usb/dwc3/dwc3-qcom-legacy.c b/drivers/usb/dwc3/dwc3-qcom-legacy.c
> index 189f5447aa786..47a0f717fd53e 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 a2608416e04ec..6501c00090c88 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;

[Severity: Low]
Does this add an unnecessary module dependency on usbcore.ko in
gadget-only DWC3 builds?

When CONFIG_USB=m, CONFIG_USB_DWC3=m, CONFIG_USB_DWC3_GADGET=y, and
CONFIG_USB_DWC3_QCOM=m, both modules now reference usb_hub_find_child()
even though DWC3 host support is compiled out and dwc->xhci is always
NULL, preventing them from loading without usbcore.ko in an initramfs.

Guarding the lookup with IS_ENABLED(CONFIG_USB_DWC3_HOST) ||
IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE), matching dwc3_host_init() in
drivers/usb/dwc3/core.h, avoids pulling in usbcore.ko in gadget-only
builds while Kconfig still guarantees CONFIG_USB is reachable.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179635104069.74470.7311513117268429199@163.com?part=1

      reply	other threads:[~2026-12-04  2:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-249004@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=hppiscas@163.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox