mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Linus Walleij <linusw@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Kees Cook <kees@kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Huacai Chen <chenhuacai@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] usb: fotg210: fix link error for CONFIG_USB=n
Date: Wed, 16 Sep 2026 10:26:05 +0200	[thread overview]
Message-ID: <20260916082623.3972767-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

Calling usb_hcd_platform_shutdown() is not possible if CONFIG_USB
is disabled:

arm-linux-gnueabi-ld: drivers/usb/fotg210/fotg210-core.o: in function `fotg210_shutdown':
fotg210-core.c:(.text+0x40): undefined reference to `usb_hcd_platform_shutdown'

Move this call into the hcd file to ensure this is only used
when USB host mode is actually available.

Fixes: 7dbc2e1ba8fd ("usb: fotg210: use the common EHCI core")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/fotg210/fotg210-core.c | 2 +-
 drivers/usb/fotg210/fotg210-hcd.c  | 5 +++++
 drivers/usb/fotg210/fotg210.h      | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/fotg210/fotg210-core.c b/drivers/usb/fotg210/fotg210-core.c
index 7976bdae5f07..86e9ecd2c8ed 100644
--- a/drivers/usb/fotg210/fotg210-core.c
+++ b/drivers/usb/fotg210/fotg210-core.c
@@ -259,7 +259,7 @@ 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)
-		usb_hcd_platform_shutdown(pdev);
+		fotg210_hcd_shutdown(pdev);
 }
 
 static int fotg210_suspend(struct device *dev)
diff --git a/drivers/usb/fotg210/fotg210-hcd.c b/drivers/usb/fotg210/fotg210-hcd.c
index 0a36820f189b..8e2346a3e23f 100644
--- a/drivers/usb/fotg210/fotg210-hcd.c
+++ b/drivers/usb/fotg210/fotg210-hcd.c
@@ -186,6 +186,11 @@ int fotg210_hcd_remove(struct platform_device *pdev)
 	return 0;
 }
 
+void fotg210_hcd_shutdown(struct platform_device *pdev)
+{
+	usb_hcd_platform_shutdown(pdev);
+}
+
 int fotg210_hcd_suspend(struct device *dev)
 {
 #ifdef CONFIG_PM
diff --git a/drivers/usb/fotg210/fotg210.h b/drivers/usb/fotg210/fotg210.h
index aab0f0300dc8..96a8cf76deeb 100644
--- a/drivers/usb/fotg210/fotg210.h
+++ b/drivers/usb/fotg210/fotg210.h
@@ -26,6 +26,7 @@ void fotg210_vbus(struct fotg210 *fotg, bool enable);
 #ifdef CONFIG_USB_FOTG210_HCD
 int fotg210_hcd_probe(struct platform_device *pdev, struct fotg210 *fotg);
 int fotg210_hcd_remove(struct platform_device *pdev);
+void fotg210_hcd_shutdown(struct platform_device *pdev);
 int fotg210_hcd_suspend(struct device *dev);
 int fotg210_hcd_resume(struct device *dev);
 int fotg210_hcd_init(void);
@@ -42,6 +43,10 @@ static inline int fotg210_hcd_remove(struct platform_device *pdev)
 	return -ENODEV;
 }
 
+static inline void fotg210_hcd_shutdown(struct platform_device *pdev)
+{
+}
+
 static inline int fotg210_hcd_suspend(struct device *dev)
 {
 	return -ENODEV;
-- 
2.53.0


             reply	other threads:[~2026-09-16  8:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  8:26 Arnd Bergmann [this message]
2026-09-16  9:45 ` Linus Walleij
2026-09-16 11:43   ` Arnd Bergmann
2026-09-16 12:47     ` Linus Walleij

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=20260916082623.3972767-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=chenhuacai@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®