[PATCH] Bluetooth: btmtk: add USB dependencies

Arnd Bergmann posted 1 patch 2 months ago
drivers/bluetooth/Kconfig | 3 +++
1 file changed, 3 insertions(+)
[PATCH] Bluetooth: btmtk: add USB dependencies
Posted by Arnd Bergmann 2 months ago
From: Arnd Bergmann <arnd@arndb.de>

The mediatek bluetooth drivers have a common portion that is now used for
all front-ends (usb, sdio, uart) but that internally relies on USB
interface functions:

ERROR: modpost: "usb_alloc_urb" [drivers/bluetooth/btmtk.ko] undefined!
ERROR: modpost: "usb_anchor_urb" [drivers/bluetooth/btmtk.ko] undefined!
ERROR: modpost: "usb_submit_urb" [drivers/bluetooth/btmtk.ko] undefined!
ERROR: modpost: "usb_free_urb" [drivers/bluetooth/btmtk.ko] undefined!
ERROR: modpost: "usb_unanchor_urb" [drivers/bluetooth/btmtk.ko] undefined!
ERROR: modpost: "usb_kill_anchored_urbs" [drivers/bluetooth/btmtk.ko] undefined!
ERROR: modpost: "usb_set_interface" [drivers/bluetooth/btmtk.ko] undefined!
ERROR: modpost: "usb_control_msg" [drivers/bluetooth/btmtk.ko] undefined!

It would be possible to split this up further, but in practice anything
that uses this driver will have USB enabled anyway and it only matters
for build testing, so just go with a much stricter dependency.

Fixes: f5c3f98946e3 ("Bluetooth: btmtkuart: rely on BT_MTK module")
Fixes: 3a722044aacf ("Bluetooth: btmtksido: rely on BT_MTK module")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/bluetooth/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index 44a2de58337b..2894a345562c 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -21,6 +21,7 @@ config BT_QCA
 
 config BT_MTK
 	tristate
+	depends on USB
 	select FW_LOADER
 
 config BT_HCIBTUSB
@@ -413,6 +414,7 @@ config BT_ATH3K
 config BT_MTKSDIO
 	tristate "MediaTek HCI SDIO driver"
 	depends on MMC
+	depends on USB
 	select BT_MTK
 	help
 	  MediaTek Bluetooth HCI SDIO driver.
@@ -425,6 +427,7 @@ config BT_MTKSDIO
 config BT_MTKUART
 	tristate "MediaTek HCI UART driver"
 	depends on SERIAL_DEV_BUS
+	depends on USB
 	select BT_MTK
 	help
 	  MediaTek Bluetooth HCI UART driver.
-- 
2.39.2
Re: [PATCH] Bluetooth: btmtk: add USB dependencies
Posted by Luiz Augusto von Dentz 2 months ago
Hi Arnd,

On Fri, Jul 19, 2024 at 6:06 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The mediatek bluetooth drivers have a common portion that is now used for
> all front-ends (usb, sdio, uart) but that internally relies on USB
> interface functions:
>
> ERROR: modpost: "usb_alloc_urb" [drivers/bluetooth/btmtk.ko] undefined!
> ERROR: modpost: "usb_anchor_urb" [drivers/bluetooth/btmtk.ko] undefined!
> ERROR: modpost: "usb_submit_urb" [drivers/bluetooth/btmtk.ko] undefined!
> ERROR: modpost: "usb_free_urb" [drivers/bluetooth/btmtk.ko] undefined!
> ERROR: modpost: "usb_unanchor_urb" [drivers/bluetooth/btmtk.ko] undefined!
> ERROR: modpost: "usb_kill_anchored_urbs" [drivers/bluetooth/btmtk.ko] undefined!
> ERROR: modpost: "usb_set_interface" [drivers/bluetooth/btmtk.ko] undefined!
> ERROR: modpost: "usb_control_msg" [drivers/bluetooth/btmtk.ko] undefined!
>
> It would be possible to split this up further, but in practice anything
> that uses this driver will have USB enabled anyway and it only matters
> for build testing, so just go with a much stricter dependency.
>
> Fixes: f5c3f98946e3 ("Bluetooth: btmtkuart: rely on BT_MTK module")
> Fixes: 3a722044aacf ("Bluetooth: btmtksido: rely on BT_MTK module")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/bluetooth/Kconfig | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index 44a2de58337b..2894a345562c 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -21,6 +21,7 @@ config BT_QCA
>
>  config BT_MTK
>         tristate
> +       depends on USB
>         select FW_LOADER
>
>  config BT_HCIBTUSB
> @@ -413,6 +414,7 @@ config BT_ATH3K
>  config BT_MTKSDIO
>         tristate "MediaTek HCI SDIO driver"
>         depends on MMC
> +       depends on USB
>         select BT_MTK
>         help
>           MediaTek Bluetooth HCI SDIO driver.
> @@ -425,6 +427,7 @@ config BT_MTKSDIO
>  config BT_MTKUART
>         tristate "MediaTek HCI UART driver"
>         depends on SERIAL_DEV_BUS
> +       depends on USB
>         select BT_MTK
>         help
>           MediaTek Bluetooth HCI UART driver.
> --
> 2.39.2

Thanks for the fix, but we went with a different one:
https://patchwork.kernel.org/project/bluetooth/patch/20240719033019.26767-1-chris.lu@mediatek.com/

-- 
Luiz Augusto von Dentz