From patchwork Fri Jun 12 11:02:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 242165 List-Id: U-Boot discussion From: rasmus.villemoes at prevas.dk (Rasmus Villemoes) Date: Fri, 12 Jun 2020 13:02:13 +0200 Subject: [RFC PATCH 1/4] common/image.c: image_decomp: put IH_COMP_XXX cases inside ifndef USE_HOSTCC In-Reply-To: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> References: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> Message-ID: <20200612110216.10355-2-rasmus.villemoes@prevas.dk> When building host tools, the CONFIG_GZIP etc. symbols are not defined anyway, so this does not (should not) change anything [1]. However, since the host tools also don't include linux/kconfig.h, one cannot use the CONFIG_IS_ENABLED() smartness in a preprocessor conditional, which in turn prevents one from adding, say, an #if CONFIG_IS_ENABLED(ZSTD) case. OTOH, with this, one can do that, and it also makes it possible to convert say, "#ifdef CONFIG_GZIP" to "#if CONFIG_IS_ENABLED(GZIP)" to make those other cases SPL-or-not-SPL-aware. [1] The gzip.h header is only included under !USE_HOSTCC, and removing the CONFIG_GZIP conditional hence both gives an "no declaration of gunzip" warning as well as breaks the link of the host tools, since the gunzip code is indeed not linked in. Signed-off-by: Rasmus Villemoes --- common/image.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/image.c b/common/image.c index e1ca1a7905..73f6845274 100644 --- a/common/image.c +++ b/common/image.c @@ -458,6 +458,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, else ret = -ENOSPC; break; +#ifndef USE_HOSTCC #ifdef CONFIG_GZIP case IH_COMP_GZIP: { ret = gunzip(load_buf, unc_len, image_buf, &image_len); @@ -508,6 +509,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, break; } #endif /* CONFIG_LZ4 */ +#endif /* !USE_HOSTCC */ default: printf("Unimplemented compression type %d\n", comp); return -ENOSYS;