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 <troykiskybound...@gmail.com>
Reviewed-by: Simon Glass <s...@chromium.org>
---

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

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

diff --git a/lib/sha256.c b/lib/sha256.c
index 4d26aea1c8c..8e1c3992674 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -8,6 +8,9 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <linux/string.h>
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#define PET_WDG
+#endif
 #else
 #include <string.h>
 #endif /* USE_HOSTCC */
@@ -276,7 +279,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 +287,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

Reply via email to