[PATCH v1 05/24] lib: sha256: prepare for CONFIG_IS_ENABLED changes

Troy Kisky troykiskyboundary at gmail.com
Wed Feb 22 02:38:02 CET 2023


We need to include <linux/kconfig.h> in order to include
files that use CONFIG_IS_ENABLED. TO prepare for that
don't pet the watchdog when USE_HOSTCC is defined.

Signed-off-by: Troy Kisky <troykiskyboundary at gmail.com>
---

 lib/sha256.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/sha256.c b/lib/sha256.c
index 4d26aea1c8c..eb31d16f996 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -8,7 +8,11 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <linux/string.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #else
+#include <linux/kconfig.h>
 #include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
@@ -276,7 +280,7 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
 		unsigned char *output, unsigned int chunk_sz)
 {
 	sha256_context ctx;
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	const unsigned char *end;
 	unsigned char *curr;
 	int chunk;
@@ -284,7 +288,7 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
 
 	sha256_starts(&ctx);
 
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#ifdef PET_WDG
 	curr = (unsigned char *)input;
 	end = input + ilen;
 	while (curr < end) {
-- 
2.34.1



More information about the U-Boot mailing list