[PATCH v2 03/26] lib: crc32: prepare for CONFIG_IS_ENABLED changes

Troy Kisky troykiskyboundary at gmail.com
Fri Feb 24 19:10:24 CET 2023


We need to include <linux/kconfig.h> in order to include
files that use CONFIG_IS_ENABLED. TO prepare for that
be more direct with using defined(USE_HOSTCC).

Signed-off-by: Troy Kisky <troykiskyboundary at gmail.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- delay include of linux/kconfig.h to do from Makefile
- as suggested by Simon

 lib/crc32.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/crc32.c b/lib/crc32.c
index aa94d70ef3e..12c104c62a4 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -14,11 +14,14 @@
 #else
 #include <common.h>
 #include <efi_loader.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #endif
 #include <compiler.h>
 #include <u-boot/crc.h>
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 #include <watchdog.h>
 #endif
 #include "u-boot/zlib.h"
@@ -84,7 +87,7 @@ static void __efi_runtime make_crc_table(void)
   }
   crc_table_empty = 0;
 }
-#elif !defined(CONFIG_ARM64_CRC32)
+#elif !defined(CONFIG_ARM64_CRC32) || defined(USE_HOSTCC)
 /* ========================================================================
  * Table of CRC-32's of all single-byte values (made by make_crc_table)
  */
@@ -184,7 +187,7 @@ const uint32_t * ZEXPORT get_crc_table()
  */
 uint32_t __efi_runtime crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
 {
-#ifdef CONFIG_ARM64_CRC32
+#if defined(CONFIG_ARM64_CRC32) && !defined(USE_HOSTCC)
     crc = cpu_to_le32(crc);
     while (len--)
         crc = __builtin_aarch64_crc32b(crc, *buf++);
@@ -243,7 +246,7 @@ uint32_t __efi_runtime crc32(uint32_t crc, const Bytef *p, uInt len)
 uint32_t crc32_wd(uint32_t crc, const unsigned char *buf, uInt len,
 		  uInt chunk_sz)
 {
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end, *curr;
 	int chunk;
 
-- 
2.34.1



More information about the U-Boot mailing list