[PATCH v1 02/24] lib: crc32: prepare for CONFIG_IS_ENABLED changes

Troy Kisky
2023-02-22T01:39:31Z

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@gmail.com>
---

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

diff --git a/lib/crc32.c b/lib/crc32.c
index aa94d70ef3e..b2fa9e06e55 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -11,14 +11,18 @@
#ifdef USE_HOSTCC
#include <arpa/inet.h>
#include <u-boot/crc.h>
+#include <linux/kconfig.h>
#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 +88,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 +188,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 +247,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