diff mbox series

[v5,09/29] image: Use Kconfig to enable CONFIG_FIT_VERBOSE on host

Message ID 20210925194327.v5.9.I0481c8d9b6f4bd7e467d0324c81295dd0a9bbc96@changeid
State Accepted
Commit e059157f0d5737b63fe2f1fec145509d82508109
Delegated to: Tom Rini
Headers show
Series image: Reduce #ifdefs and ad-hoc defines in image code (Part B) | expand

Commit Message

Simon Glass Sept. 26, 2021, 1:43 a.m. UTC
Add a host Kconfig for FIT_VERBOSE. With this we can use
CONFIG_IS_ENABLED(FIT_VERBOSE) directly in the host build, so drop the
forcing of this in the image.h header.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v5:
- Use TOOLS_ instead of HOST_

 include/image.h | 5 ++---
 tools/Kconfig   | 5 +++++
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Alexandru Gagniuc Oct. 5, 2021, 6:29 p.m. UTC | #1
On 9/25/21 8:43 PM, Simon Glass wrote:
> Add a host Kconfig for FIT_VERBOSE. With this we can use
> CONFIG_IS_ENABLED(FIT_VERBOSE) directly in the host build, so drop the

s/host build/ tools build/

> forcing of this in the image.h header.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

> ---
> 
> Changes in v5:
> - Use TOOLS_ instead of HOST_
> 
>   include/image.h | 5 ++---
>   tools/Kconfig   | 5 +++++
>   2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/include/image.h b/include/image.h
> index f09eb9de516..6efbef06e64 100644
> --- a/include/image.h
> +++ b/include/image.h
> @@ -28,7 +28,6 @@ struct fdt_region;
>   #include <linux/kconfig.h>
>   
>   /* new uImage format support enabled on host */
> -#define CONFIG_FIT_VERBOSE	1 /* enable fit_format_{error,warning}() */
>   #define CONFIG_FIT_RSASSA_PSS 1
>   
>   #define IMAGE_ENABLE_IGNORE	0
> @@ -1458,7 +1457,7 @@ int fit_image_cipher_get_algo(const void *fit, int noffset, char **algo);
>   
>   struct cipher_algo *image_get_cipher_algo(const char *full_name);
>   
> -#ifdef CONFIG_FIT_VERBOSE
> +#if CONFIG_IS_ENABLED(FIT_VERBOSE)
>   #define fit_unsupported(msg)	printf("! %s:%d " \
>   				"FIT images not supported for '%s'\n", \
>   				__FILE__, __LINE__, (msg))

I think if we made this a higher level message, like debug, or spew. we 
wouldn't need to #ifdef it out with a CONFIG in the first place.

> @@ -1470,7 +1469,7 @@ struct cipher_algo *image_get_cipher_algo(const char *full_name);
>   #else
>   #define fit_unsupported(msg)
>   #define fit_unsupported_reset(msg)
> -#endif /* CONFIG_FIT_VERBOSE */
> +#endif /* FIT_VERBOSE */
>   #endif /* CONFIG_FIT */
>   
>   #if !defined(USE_HOSTCC)
> diff --git a/tools/Kconfig b/tools/Kconfig
> index 747d221803f..9d1c0efd40c 100644
> --- a/tools/Kconfig
> +++ b/tools/Kconfig
> @@ -45,6 +45,11 @@ config TOOLS_FIT_SIGNATURE_MAX_SIZE
>   	depends on TOOLS_FIT_SIGNATURE
>   	default 0x10000000
>   
> +config TOOLS_FIT_VERBOSE
> +	def_bool y
> +	help
> +	  Support verbose FIT output in the tools builds
> +
>   config TOOLS_MD5
>   	def_bool y
>   	help
>
Tom Rini Oct. 9, 2021, 1:40 a.m. UTC | #2
On Sat, Sep 25, 2021 at 07:43:22PM -0600, Simon Glass wrote:

> Add a host Kconfig for FIT_VERBOSE. With this we can use
> CONFIG_IS_ENABLED(FIT_VERBOSE) directly in the tools build, so drop the
> forcing of this in the image.h header.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/include/image.h b/include/image.h
index f09eb9de516..6efbef06e64 100644
--- a/include/image.h
+++ b/include/image.h
@@ -28,7 +28,6 @@  struct fdt_region;
 #include <linux/kconfig.h>
 
 /* new uImage format support enabled on host */
-#define CONFIG_FIT_VERBOSE	1 /* enable fit_format_{error,warning}() */
 #define CONFIG_FIT_RSASSA_PSS 1
 
 #define IMAGE_ENABLE_IGNORE	0
@@ -1458,7 +1457,7 @@  int fit_image_cipher_get_algo(const void *fit, int noffset, char **algo);
 
 struct cipher_algo *image_get_cipher_algo(const char *full_name);
 
-#ifdef CONFIG_FIT_VERBOSE
+#if CONFIG_IS_ENABLED(FIT_VERBOSE)
 #define fit_unsupported(msg)	printf("! %s:%d " \
 				"FIT images not supported for '%s'\n", \
 				__FILE__, __LINE__, (msg))
@@ -1470,7 +1469,7 @@  struct cipher_algo *image_get_cipher_algo(const char *full_name);
 #else
 #define fit_unsupported(msg)
 #define fit_unsupported_reset(msg)
-#endif /* CONFIG_FIT_VERBOSE */
+#endif /* FIT_VERBOSE */
 #endif /* CONFIG_FIT */
 
 #if !defined(USE_HOSTCC)
diff --git a/tools/Kconfig b/tools/Kconfig
index 747d221803f..9d1c0efd40c 100644
--- a/tools/Kconfig
+++ b/tools/Kconfig
@@ -45,6 +45,11 @@  config TOOLS_FIT_SIGNATURE_MAX_SIZE
 	depends on TOOLS_FIT_SIGNATURE
 	default 0x10000000
 
+config TOOLS_FIT_VERBOSE
+	def_bool y
+	help
+	  Support verbose FIT output in the tools builds
+
 config TOOLS_MD5
 	def_bool y
 	help