gemini: Add kernel v6.1 patches
[openwrt/openwrt.git] / target / linux / gemini / patches-6.1 / 0014-usb-fotg210-fix-OTG-only-build.patch
1 From d8eed400495029ba551704ff0fae1dad87332291 Mon Sep 17 00:00:00 2001
2 From: Arnd Bergmann <arnd@arndb.de>
3 Date: Thu, 15 Dec 2022 17:57:20 +0100
4 Subject: [PATCH 14/29] usb: fotg210: fix OTG-only build
5
6 The fotg210 module combines the HCD and OTG drivers, which then
7 fails to build when only the USB gadget support is enabled
8 in the kernel but host support is not:
9
10 aarch64-linux-ld: drivers/usb/fotg210/fotg210-core.o: in function `fotg210_init':
11 fotg210-core.c:(.init.text+0xc): undefined reference to `usb_disabled'
12
13 Move the check for usb_disabled() after the check for the HCD module,
14 and let the OTG driver still be probed in this configuration.
15
16 A nicer approach might be to have the common portion built as a
17 library module, with the two platform other files registering
18 their own platform_driver instances separately.
19
20 Fixes: ddacd6ef44ca ("usb: fotg210: Fix Kconfig for USB host modules")
21 Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
22 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
23 Link: https://lore.kernel.org/r/20221215165728.2062984-1-arnd@kernel.org
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 --- a/drivers/usb/fotg210/fotg210-core.c
27 +++ b/drivers/usb/fotg210/fotg210-core.c
28 @@ -144,10 +144,7 @@ static struct platform_driver fotg210_dr
29
30 static int __init fotg210_init(void)
31 {
32 - if (usb_disabled())
33 - return -ENODEV;
34 -
35 - if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
36 + if (IS_ENABLED(CONFIG_USB_FOTG210_HCD) && !usb_disabled())
37 fotg210_hcd_init();
38 return platform_driver_register(&fotg210_driver);
39 }