diff mbox series

[U-Boot,v1,8/8] spl: disk: usb: Add dependencies to sprintf/strto*

Message ID 1524042143-30213-9-git-send-email-alex.kiernan@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Fix SPL build without CONFIG_SPL_SERIAL_SUPPORT | expand

Commit Message

Alex Kiernan April 18, 2018, 9:02 a.m. UTC
If SPL serial support is disabled nothing brings in sprintf, snprintf
or simple_strtoul:

  env/built-in.o: In function `regex_callback':
  env/attr.c:128: undefined reference to `sprintf'
  disk/built-in.o: In function `blk_get_device_by_str':
  disk/part.c:386: undefined reference to `simple_strtoul'
  disk/part.c:395: undefined reference to `simple_strtoul'
  disk/built-in.o: In function `blk_get_device_part_str':
  disk/part.c:522: undefined reference to `simple_strtoul'
  disk/built-in.o: In function `part_set_generic_name':
  disk/part.c:704: undefined reference to `sprintf'
  drivers/built-in.o: In function `init_peripheral_ep':
  drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
  drivers/built-in.o: In function `musb_core_init':
  drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'

Add those dependencies here.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

 disk/Kconfig                 | 4 ++++
 drivers/usb/musb-new/Kconfig | 4 ++++
 2 files changed, 8 insertions(+)

Comments

Maxime Ripard April 18, 2018, 9:11 a.m. UTC | #1
On Wed, Apr 18, 2018 at 09:02:23AM +0000, Alex Kiernan wrote:
> If SPL serial support is disabled nothing brings in sprintf, snprintf
> or simple_strtoul:
> 
>   env/built-in.o: In function `regex_callback':
>   env/attr.c:128: undefined reference to `sprintf'
>   disk/built-in.o: In function `blk_get_device_by_str':
>   disk/part.c:386: undefined reference to `simple_strtoul'
>   disk/part.c:395: undefined reference to `simple_strtoul'
>   disk/built-in.o: In function `blk_get_device_part_str':
>   disk/part.c:522: undefined reference to `simple_strtoul'
>   disk/built-in.o: In function `part_set_generic_name':
>   disk/part.c:704: undefined reference to `sprintf'
>   drivers/built-in.o: In function `init_peripheral_ep':
>   drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
>   drivers/built-in.o: In function `musb_core_init':
>   drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'
> 
> Add those dependencies here.
> 
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
> 
>  disk/Kconfig                 | 4 ++++
>  drivers/usb/musb-new/Kconfig | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/disk/Kconfig b/disk/Kconfig
> index 8af2a95..f9f8416 100644
> --- a/disk/Kconfig
> +++ b/disk/Kconfig
> @@ -4,6 +4,10 @@ menu "Partition Types"
>  config PARTITIONS
>  	bool "Enable Partition Labels (disklabels) support"
>  	default y
> +	select SPL_SPRINTF
> +	select TPL_SPRINTF
> +	select SPL_STRTO
> +	select TPL_STRTO
>  	help
>  	  Partition Labels (disklabels) Supported:
>  	  Zero or more of the following:
> diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig
> index ea5bae2..46ae794 100644
> --- a/drivers/usb/musb-new/Kconfig
> +++ b/drivers/usb/musb-new/Kconfig
> @@ -5,12 +5,16 @@ comment "MUSB Controller Driver"
>  
>  config USB_MUSB_HOST
>  	bool "MUSB host mode support"
> +	select SPL_SPRINTF
> +	select TPL_SPRINTF
>  	help
>  	  Enables the MUSB USB dual-role controller in host mode.
>  
>  config USB_MUSB_GADGET
>  	bool "MUSB gadget mode support"
>  	select USB_GADGET_DUALSPEED
> +	select SPL_SPRINTF
> +	select TPL_SPRINTF

I guess that's only true if the support is enabled in the SPL / TPL in
the first place?

Maxime
Alex Kiernan April 18, 2018, 10:27 a.m. UTC | #2
On Wed, Apr 18, 2018 at 10:11 AM, Maxime Ripard
<maxime.ripard@bootlin.com> wrote:
> On Wed, Apr 18, 2018 at 09:02:23AM +0000, Alex Kiernan wrote:
>> If SPL serial support is disabled nothing brings in sprintf, snprintf
>> or simple_strtoul:
>>
>>   env/built-in.o: In function `regex_callback':
>>   env/attr.c:128: undefined reference to `sprintf'
>>   disk/built-in.o: In function `blk_get_device_by_str':
>>   disk/part.c:386: undefined reference to `simple_strtoul'
>>   disk/part.c:395: undefined reference to `simple_strtoul'
>>   disk/built-in.o: In function `blk_get_device_part_str':
>>   disk/part.c:522: undefined reference to `simple_strtoul'
>>   disk/built-in.o: In function `part_set_generic_name':
>>   disk/part.c:704: undefined reference to `sprintf'
>>   drivers/built-in.o: In function `init_peripheral_ep':
>>   drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
>>   drivers/built-in.o: In function `musb_core_init':
>>   drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'
>>
>> Add those dependencies here.
>>
>> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
>> ---
>>
>>  disk/Kconfig                 | 4 ++++
>>  drivers/usb/musb-new/Kconfig | 4 ++++
>>  2 files changed, 8 insertions(+)
>>
>> diff --git a/disk/Kconfig b/disk/Kconfig
>> index 8af2a95..f9f8416 100644
>> --- a/disk/Kconfig
>> +++ b/disk/Kconfig
>> @@ -4,6 +4,10 @@ menu "Partition Types"
>>  config PARTITIONS
>>       bool "Enable Partition Labels (disklabels) support"
>>       default y
>> +     select SPL_SPRINTF
>> +     select TPL_SPRINTF
>> +     select SPL_STRTO
>> +     select TPL_STRTO
>>       help
>>         Partition Labels (disklabels) Supported:
>>         Zero or more of the following:
>> diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig
>> index ea5bae2..46ae794 100644
>> --- a/drivers/usb/musb-new/Kconfig
>> +++ b/drivers/usb/musb-new/Kconfig
>> @@ -5,12 +5,16 @@ comment "MUSB Controller Driver"
>>
>>  config USB_MUSB_HOST
>>       bool "MUSB host mode support"
>> +     select SPL_SPRINTF
>> +     select TPL_SPRINTF
>>       help
>>         Enables the MUSB USB dual-role controller in host mode.
>>
>>  config USB_MUSB_GADGET
>>       bool "MUSB gadget mode support"
>>       select USB_GADGET_DUALSPEED
>> +     select SPL_SPRINTF
>> +     select TPL_SPRINTF
>
> I guess that's only true if the support is enabled in the SPL / TPL in
> the first place?
>

We've a mix today of "select SPL_..." and "select SPL_... if SPL" -
roughly three times as many without the "... if SPL", which was why I
picked that style, but looking more closely you do get those symbols
then appearing in non-SPL builds.

The guards I have only apply if you are SPL/TPL, but the more I stare
at it, the more correct it feels to have them guarded here against
SPL/TPL.
diff mbox series

Patch

diff --git a/disk/Kconfig b/disk/Kconfig
index 8af2a95..f9f8416 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -4,6 +4,10 @@  menu "Partition Types"
 config PARTITIONS
 	bool "Enable Partition Labels (disklabels) support"
 	default y
+	select SPL_SPRINTF
+	select TPL_SPRINTF
+	select SPL_STRTO
+	select TPL_STRTO
 	help
 	  Partition Labels (disklabels) Supported:
 	  Zero or more of the following:
diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig
index ea5bae2..46ae794 100644
--- a/drivers/usb/musb-new/Kconfig
+++ b/drivers/usb/musb-new/Kconfig
@@ -5,12 +5,16 @@  comment "MUSB Controller Driver"
 
 config USB_MUSB_HOST
 	bool "MUSB host mode support"
+	select SPL_SPRINTF
+	select TPL_SPRINTF
 	help
 	  Enables the MUSB USB dual-role controller in host mode.
 
 config USB_MUSB_GADGET
 	bool "MUSB gadget mode support"
 	select USB_GADGET_DUALSPEED
+	select SPL_SPRINTF
+	select TPL_SPRINTF
 	help
 	  Enables the MUSB USB dual-role controller in gadget mode.