[PATCH] spl: Move check for SPL_LIBCOMMON support to header

Tom Rini trini at konsulko.com
Mon Jul 18 14:08:19 CEST 2022


On Fri, Jul 15, 2022 at 10:35:00AM -0500, Andrew Davis wrote:

> From: "Andrew F. Davis" <afd at ti.com>
> 
> Print statements in SPL depend on lib/common support, due to this many
> such print statements are ifdef'd. Instead of checking at each call site
> move the check to the common.h header and remove these inline checks.
> 
> Signed-off-by: Andrew F. Davis <afd at ti.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>

I thought we had this already, but I guess not.  That said:

[snip]
> diff --git a/include/stdio.h b/include/stdio.h
> index 1939a48f0f..2fbc3da5f9 100644
> --- a/include/stdio.h
> +++ b/include/stdio.h
> @@ -10,9 +10,8 @@ int tstc(void);
>  
>  /* stdout */
>  #if !defined(CONFIG_SPL_BUILD) || \
> -	(defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL)) || \
> -	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \
> -		defined(CONFIG_SPL_SERIAL))
> +	(defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL) && defined(CONFIG_TPL_LIBCOMMON_SUPPORT)) || \
> +	(defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_SERIAL) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && !defined(CONFIG_TPL_BUILD))

Can we write this as something like:
#if !defined(CONFIG_SPL_BUILD) || \
	(CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(SERIAL) &&
	CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT))

?  I'm not 100% sure it will work for CONFIG_SPL_BUILD /
CONFIG_TPL_BUILD but it should for the rest and mean we can slightly
clean it up.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220718/e96040a4/attachment.sig>


More information about the U-Boot mailing list