[PATCH v2] usb: fotg210: guard host shutdown in gadget-only builds

Linus Walleij posted 1 patch 1 week, 4 days ago
drivers/usb/fotg210/fotg210-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v2] usb: fotg210: guard host shutdown in gadget-only builds
Posted by Linus Walleij 1 week, 4 days ago
FOTG210 can be built with CONFIG_USB=n, but its shutdown callback
references usb_hcd_platform_shutdown() from the USB host core,
causing a link failure.

Guard the call with CONFIG_USB_FOTG210_HCD so gadget-only builds do
not reference the host shutdown helper.

Fixes: 7dbc2e1ba8fd ("usb: fotg210: use the common EHCI core")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202609141128.DQicnuRW-lkp@intel.com/
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
Fix the gadget-only build failure introduced by the FOTG210 common
EHCI conversion by guarding the host shutdown call.

Based on the complete FOTG210 modernization series. Verified with
PowerPC64 gadget-only and Gemini host object builds using LLVM.
---
Changes in v2:
- Add Fixes: tag for the commit on Gregs usb-next branch.
- Link to v1: https://patch.msgid.link/20260914-fotg210-ehci-fixes-v1-1-a75ca67fac04@kernel.org
---
 drivers/usb/fotg210/fotg210-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/fotg210/fotg210-core.c b/drivers/usb/fotg210/fotg210-core.c
index 7976bdae5f07..7de49b7eb3aa 100644
--- a/drivers/usb/fotg210/fotg210-core.c
+++ b/drivers/usb/fotg210/fotg210-core.c
@@ -258,7 +258,8 @@ static void fotg210_remove(struct platform_device *pdev)
 
 static void fotg210_shutdown(struct platform_device *pdev)
 {
-	if (usb_get_dr_mode(&pdev->dev) != USB_DR_MODE_PERIPHERAL)
+	if (IS_ENABLED(CONFIG_USB_FOTG210_HCD) &&
+	    usb_get_dr_mode(&pdev->dev) != USB_DR_MODE_PERIPHERAL)
 		usb_hcd_platform_shutdown(pdev);
 }
 

---
base-commit: da11df946e2c5288ba1124b20af7faada58b85eb
change-id: 20260914-fotg210-ehci-fixes-18d074ae390e

Best regards,
--  
Linus Walleij <linusw@kernel.org>