[RFC PATCH 3/8] cyclic: Introduce schedule() function

Stefan Roese sr at denx.de
Mon Aug 29 08:23:08 CEST 2022


This patch introduces a schedule() function, which shall be used instead
of the old WATCHDOG_RESET. Follow-up patches will make sure, that this
new function is used.

Signed-off-by: Stefan Roese <sr at denx.de>
---
 common/cyclic.c  | 11 +++++++++++
 include/cyclic.h |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/common/cyclic.c b/common/cyclic.c
index 766a98382596..6402af4542e9 100644
--- a/common/cyclic.c
+++ b/common/cyclic.c
@@ -20,6 +20,8 @@ struct list_head cyclic_list;
 static bool cyclic_ready;
 static bool cyclic_running;
 
+void hw_watchdog_reset(void);
+
 struct cyclic_info *cyclic_register(cyclic_func_t func, uint64_t delay_us,
 				    const char *name, void *ctx)
 {
@@ -93,6 +95,15 @@ void cyclic_run(void)
 	cyclic_running = false;
 }
 
+void schedule(void)
+{
+	/* The HW watchdog is not integrated into the cyclic IF (yet) */
+	if (IS_ENABLED(CONFIG_HW_WATCHDOG))
+		hw_watchdog_reset();
+
+	cyclic_run();
+}
+
 int cyclic_uninit(void)
 {
 	struct cyclic_info *cyclic, *tmp;
diff --git a/include/cyclic.h b/include/cyclic.h
index 2ae1cba32f20..5cea3fb3e9b4 100644
--- a/include/cyclic.h
+++ b/include/cyclic.h
@@ -78,6 +78,7 @@ int cyclic_init(void);
 int cyclic_uninit(void);
 
 void cyclic_run(void);
+void schedule(void);
 #else
 static inline struct cyclic_info *cyclic_register(cyclic_func_t func,
 						  uint64_t delay_us,
@@ -96,6 +97,10 @@ static inline void cyclic_run(void)
 {
 }
 
+static inline void schedule(void)
+{
+}
+
 static inline int cyclic_init(void)
 {
 	return 0;
-- 
2.37.2



More information about the U-Boot mailing list