Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: try to improve CONFIG_SERIAL_DEV_BUS dependency

With CONFIG_SERIAL_DEV_BUS=m, the hci_serdev.o file does not actually
get built into hci_uart.o as the Makefile doesn't pick it up, leading
to a link error with anything referring to it:

ERROR: "hci_uart_register_device" [drivers/bluetooth/hci_nokia.ko] undefined!
scripts/Makefile.modpost:91: recipe for target '__modpost' failed

Changing this in the Makefile would cause another problem when
hci_uart itself is built-in and cannot reference symbols from the
serdev module.

This tries to address both problems by introducing a new hidden
Kconfig symbol that controls both the compilation of hci_serdev.o
and whether the Nokia driver can be selected. This seems to address
the problem for me, though there might be a better way to do it.

Fixes: 7bb318680e86 ("Bluetooth: add nokia driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Arnd Bergmann and committed by
Marcel Holtmann
1fb78fb6 f2edd9f6

+8 -2
+7 -1
drivers/bluetooth/Kconfig
··· 76 76 Say Y here to compile support for Bluetooth UART devices into the 77 77 kernel or say M to compile it as module (hci_uart). 78 78 79 + config BT_HCIUART_SERDEV 80 + bool 81 + depends on SERIAL_DEV_BUS && BT_HCIUART 82 + depends on SERIAL_DEV_BUS=y || SERIAL_DEV_BUS=BT_HCIUART 83 + default y 84 + 79 85 config BT_HCIUART_H4 80 86 bool "UART (H4) protocol support" 81 87 depends on BT_HCIUART ··· 95 89 config BT_HCIUART_NOKIA 96 90 tristate "UART Nokia H4+ protocol support" 97 91 depends on BT_HCIUART 98 - depends on SERIAL_DEV_BUS 92 + depends on BT_HCIUART_SERDEV 99 93 depends on PM 100 94 help 101 95 Nokia H4+ is serial protocol for communication between Bluetooth
+1 -1
drivers/bluetooth/Makefile
··· 31 31 btmrvl-$(CONFIG_DEBUG_FS) += btmrvl_debugfs.o 32 32 33 33 hci_uart-y := hci_ldisc.o 34 - hci_uart-$(CONFIG_SERIAL_DEV_BUS) += hci_serdev.o 34 + hci_uart-$(CONFIG_BT_HCIUART_SERDEV) += hci_serdev.o 35 35 hci_uart-$(CONFIG_BT_HCIUART_H4) += hci_h4.o 36 36 hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o 37 37 hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o