linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency
@ 2017-04-19 17:50 Arnd Bergmann
  2017-04-19 20:09 ` Marcel Holtmann
  2017-04-20  0:15 ` Sebastian Reichel
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2017-04-19 17:50 UTC (permalink / raw)
  To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg
  Cc: Sebastian Reichel, Rob Herring, Arnd Bergmann, Bjorn Andersson,
	David S. Miller, Kalle Valo, linux-bluetooth, linux-kernel

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>
---
 drivers/bluetooth/Kconfig  | 8 +++++++-
 drivers/bluetooth/Makefile | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index 8aafbed9e160..737d93ef27c5 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -76,6 +76,12 @@ config BT_HCIUART
 	  Say Y here to compile support for Bluetooth UART devices into the
 	  kernel or say M to compile it as module (hci_uart).
 
+config BT_HCIUART_SERDEV
+	bool
+	depends on SERIAL_DEV_BUS && BT_HCIUART
+	depends on SERIAL_DEV_BUS=y || SERIAL_DEV_BUS=BT_HCIUART
+	default y
+
 config BT_HCIUART_H4
 	bool "UART (H4) protocol support"
 	depends on BT_HCIUART
@@ -89,7 +95,7 @@ config BT_HCIUART_H4
 config BT_HCIUART_NOKIA
 	tristate "UART Nokia H4+ protocol support"
 	depends on BT_HCIUART
-	depends on SERIAL_DEV_BUS
+	depends on BT_HCIUART_SERDEV
 	depends on PM
 	help
 	  Nokia H4+ is serial protocol for communication between Bluetooth
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index a7f237320f4b..e693ca6eeed9 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -31,7 +31,7 @@ btmrvl-y			:= btmrvl_main.o
 btmrvl-$(CONFIG_DEBUG_FS)	+= btmrvl_debugfs.o
 
 hci_uart-y				:= hci_ldisc.o
-hci_uart-$(CONFIG_SERIAL_DEV_BUS)	+= hci_serdev.o
+hci_uart-$(CONFIG_BT_HCIUART_SERDEV)	+= hci_serdev.o
 hci_uart-$(CONFIG_BT_HCIUART_H4)	+= hci_h4.o
 hci_uart-$(CONFIG_BT_HCIUART_BCSP)	+= hci_bcsp.o
 hci_uart-$(CONFIG_BT_HCIUART_LL)	+= hci_ll.o
-- 
2.9.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency
  2017-04-19 17:50 [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency Arnd Bergmann
@ 2017-04-19 20:09 ` Marcel Holtmann
  2017-04-20  0:15 ` Sebastian Reichel
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2017-04-19 20:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Gustavo F. Padovan, Johan Hedberg, Sebastian Reichel,
	Rob Herring, Bjorn Andersson, David S. Miller, Kalle Valo,
	Linux Bluetooth, linux-kernel

Hi Arnd,

> 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>
> ---
> drivers/bluetooth/Kconfig  | 8 +++++++-
> drivers/bluetooth/Makefile | 2 +-
> 2 files changed, 8 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency
  2017-04-19 17:50 [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency Arnd Bergmann
  2017-04-19 20:09 ` Marcel Holtmann
@ 2017-04-20  0:15 ` Sebastian Reichel
  2017-04-20  6:55   ` Marcel Holtmann
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Reichel @ 2017-04-20  0:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, Rob Herring,
	Bjorn Andersson, David S. Miller, Kalle Valo, linux-bluetooth,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2808 bytes --]

Hi,

On Wed, Apr 19, 2017 at 07:50:18PM +0200, Arnd Bergmann wrote:
> 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>
> ---
>  drivers/bluetooth/Kconfig  | 8 +++++++-
>  drivers/bluetooth/Makefile | 2 +-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index 8aafbed9e160..737d93ef27c5 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -76,6 +76,12 @@ config BT_HCIUART
>  	  Say Y here to compile support for Bluetooth UART devices into the
>  	  kernel or say M to compile it as module (hci_uart).
>  
> +config BT_HCIUART_SERDEV
> +	bool
> +	depends on SERIAL_DEV_BUS && BT_HCIUART
> +	depends on SERIAL_DEV_BUS=y || SERIAL_DEV_BUS=BT_HCIUART
> +	default y
> +
>  config BT_HCIUART_H4
>  	bool "UART (H4) protocol support"
>  	depends on BT_HCIUART
> @@ -89,7 +95,7 @@ config BT_HCIUART_H4
>  config BT_HCIUART_NOKIA
>  	tristate "UART Nokia H4+ protocol support"
>  	depends on BT_HCIUART

I guess BT_HCIUART dependency is no longer needed
when we have BT_HCIUART_SERDEV dependency?

Otherwise:

Reviewed-by: Sebastian Reichel <sre@kernel.org>

> -	depends on SERIAL_DEV_BUS
> +	depends on BT_HCIUART_SERDEV
>  	depends on PM
>  	help
>  	  Nokia H4+ is serial protocol for communication between Bluetooth
> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
> index a7f237320f4b..e693ca6eeed9 100644
> --- a/drivers/bluetooth/Makefile
> +++ b/drivers/bluetooth/Makefile
> @@ -31,7 +31,7 @@ btmrvl-y			:= btmrvl_main.o
>  btmrvl-$(CONFIG_DEBUG_FS)	+= btmrvl_debugfs.o
>  
>  hci_uart-y				:= hci_ldisc.o
> -hci_uart-$(CONFIG_SERIAL_DEV_BUS)	+= hci_serdev.o
> +hci_uart-$(CONFIG_BT_HCIUART_SERDEV)	+= hci_serdev.o
>  hci_uart-$(CONFIG_BT_HCIUART_H4)	+= hci_h4.o
>  hci_uart-$(CONFIG_BT_HCIUART_BCSP)	+= hci_bcsp.o
>  hci_uart-$(CONFIG_BT_HCIUART_LL)	+= hci_ll.o
> -- 
> 2.9.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency
  2017-04-20  0:15 ` Sebastian Reichel
@ 2017-04-20  6:55   ` Marcel Holtmann
  2017-04-20  7:02     ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2017-04-20  6:55 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Arnd Bergmann, Gustavo F. Padovan, Johan Hedberg, Rob Herring,
	Bjorn Andersson, David S. Miller, Kalle Valo, linux-bluetooth,
	linux-kernel

Hi Sebastian,

>> 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>
>> ---
>> drivers/bluetooth/Kconfig  | 8 +++++++-
>> drivers/bluetooth/Makefile | 2 +-
>> 2 files changed, 8 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
>> index 8aafbed9e160..737d93ef27c5 100644
>> --- a/drivers/bluetooth/Kconfig
>> +++ b/drivers/bluetooth/Kconfig
>> @@ -76,6 +76,12 @@ config BT_HCIUART
>> 	  Say Y here to compile support for Bluetooth UART devices into the
>> 	  kernel or say M to compile it as module (hci_uart).
>> 
>> +config BT_HCIUART_SERDEV
>> +	bool
>> +	depends on SERIAL_DEV_BUS && BT_HCIUART
>> +	depends on SERIAL_DEV_BUS=y || SERIAL_DEV_BUS=BT_HCIUART
>> +	default y
>> +
>> config BT_HCIUART_H4
>> 	bool "UART (H4) protocol support"
>> 	depends on BT_HCIUART
>> @@ -89,7 +95,7 @@ config BT_HCIUART_H4
>> config BT_HCIUART_NOKIA
>> 	tristate "UART Nokia H4+ protocol support"
>> 	depends on BT_HCIUART
> 
> I guess BT_HCIUART dependency is no longer needed
> when we have BT_HCIUART_SERDEV dependency?

if so then we need another patch since I already applied the one from Arnd.

Regards

Marcel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency
  2017-04-20  6:55   ` Marcel Holtmann
@ 2017-04-20  7:02     ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2017-04-20  7:02 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Sebastian Reichel, Gustavo F. Padovan, Johan Hedberg,
	Rob Herring, Bjorn Andersson, David S. Miller, Kalle Valo,
	linux-bluetooth, Linux Kernel Mailing List

On Thu, Apr 20, 2017 at 8:55 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Sebastian,
>
>>> 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>
>>> ---
>>> drivers/bluetooth/Kconfig  | 8 +++++++-
>>> drivers/bluetooth/Makefile | 2 +-
>>> 2 files changed, 8 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
>>> index 8aafbed9e160..737d93ef27c5 100644
>>> --- a/drivers/bluetooth/Kconfig
>>> +++ b/drivers/bluetooth/Kconfig
>>> @@ -76,6 +76,12 @@ config BT_HCIUART
>>>        Say Y here to compile support for Bluetooth UART devices into the
>>>        kernel or say M to compile it as module (hci_uart).
>>>
>>> +config BT_HCIUART_SERDEV
>>> +    bool
>>> +    depends on SERIAL_DEV_BUS && BT_HCIUART
>>> +    depends on SERIAL_DEV_BUS=y || SERIAL_DEV_BUS=BT_HCIUART
>>> +    default y
>>> +
>>> config BT_HCIUART_H4
>>>      bool "UART (H4) protocol support"
>>>      depends on BT_HCIUART
>>> @@ -89,7 +95,7 @@ config BT_HCIUART_H4
>>> config BT_HCIUART_NOKIA
>>>      tristate "UART Nokia H4+ protocol support"
>>>      depends on BT_HCIUART
>>
>> I guess BT_HCIUART dependency is no longer needed
>> when we have BT_HCIUART_SERDEV dependency?
>
> if so then we need another patch since I already applied the one from Arnd.

We need both dependencies: BT_HCIUART_SERDEV is a 'bool'
symbol controlling whether subdrivers are able to use symbols
exported by the serdev code, while BT_HCIUART is a tristate
symbol and we need to depend on that to ensure that
BT_HCIUART_NOKIA cannot be set to '=y' when
BT_HCIUART=m.

No further patch should be needed.

    Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-20  7:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 17:50 [PATCH] blutooth: try to improve CONFIG_SERIAL_DEV_BUS dependency Arnd Bergmann
2017-04-19 20:09 ` Marcel Holtmann
2017-04-20  0:15 ` Sebastian Reichel
2017-04-20  6:55   ` Marcel Holtmann
2017-04-20  7:02     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).