]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cyclic: Integrate cyclic infrastructure into WATCHDOG_RESET
authorStefan Roese <sr@denx.de>
Fri, 2 Sep 2022 11:57:49 +0000 (13:57 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 13 Sep 2022 20:01:43 +0000 (16:01 -0400)
This patch integrates the main function responsible for calling all
registered cyclic functions cyclic_run() into the common WATCHDOG_RESET
macro. This guarantees that cyclic_run() is executed very often, which
is necessary for the cyclic functions to get scheduled and executed at
their configured periods.

If CONFIG_WATCHDOG is not enabled, only cyclic_run() without calling
watchdog_reset(). This guarantees that the cyclic functionality does not
rely on CONFIG_WATCHDOG being enabled.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
fs/cramfs/uncompress.c
include/watchdog.h

index f431cc46c1f756bb3100d5dd9830099c241cc628..38e10e2e44224bff41d0c9c9641f1befd59f9e1b 100644 (file)
@@ -62,7 +62,7 @@ int cramfs_uncompress_init (void)
        stream.avail_in = 0;
 
 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
-       stream.outcb = (cb_func) WATCHDOG_RESET;
+       stream.outcb = (cb_func)watchdog_reset_func;
 #else
        stream.outcb = Z_NULL;
 #endif /* CONFIG_HW_WATCHDOG */
index 813cc8f2a5d301bddb2fcde07cb32d12254a19dc..0a9777edcbad40348a0b000ff3d01d98673161b5 100644 (file)
@@ -11,6 +11,8 @@
 #define _WATCHDOG_H_
 
 #if !defined(__ASSEMBLY__)
+#include <cyclic.h>
+
 /*
  * Reset the watchdog timer, always returns 0
  *
@@ -60,11 +62,16 @@ int init_func_watchdog_reset(void);
                        /* Don't require the watchdog to be enabled in SPL */
                        #if defined(CONFIG_SPL_BUILD) &&                \
                                !defined(CONFIG_SPL_WATCHDOG)
-                               #define WATCHDOG_RESET() {}
+                               #define WATCHDOG_RESET() { \
+                                       cyclic_run(); \
+                               }
                        #else
                                extern void watchdog_reset(void);
 
-                               #define WATCHDOG_RESET watchdog_reset
+                               #define WATCHDOG_RESET() { \
+                                       watchdog_reset(); \
+                                       cyclic_run(); \
+                               }
                        #endif
                #endif
        #else
@@ -74,11 +81,21 @@ int init_func_watchdog_reset(void);
                #if defined(__ASSEMBLY__)
                        #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
                #else
-                       #define WATCHDOG_RESET() {}
+                       #define WATCHDOG_RESET() { \
+                               cyclic_run(); \
+                       }
                #endif /* __ASSEMBLY__ */
        #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
 #endif /* CONFIG_HW_WATCHDOG */
 
+#if !defined(__ASSEMBLY__)
+/* Currently only needed for fs/cramfs/uncompress.c */
+static inline void watchdog_reset_func(void)
+{
+       WATCHDOG_RESET();
+}
+#endif
+
 /*
  * Prototypes from $(CPU)/cpu.c.
  */