public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 00/13] disentangling cyclic API from schedule()
@ 2024-10-03 21:27 Rasmus Villemoes
  2024-10-03 21:27 ` [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET Rasmus Villemoes
                   ` (14 more replies)
  0 siblings, 15 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

These patches are part of a longer-term plan to properly deal with the
HW_WATCHDOG vs WATCHDOG dichotomy, and getting rid of the legacy
HW_WATCHDOG concept completely. As part of that, clean up which
headers include other headers.

While schedule(), the artist formerly known as WATCHDOG_RESET(), is
obviously called all over the tree, very few TUs make use of the
cyclic API (cyclic_register etc.). And there's really no reason at all
for global_data.h to include cyclic.h - except that some places
implicitly rely on getting their declaration of schedule() through
that include.

So this introduces a separate mostly trivial header that just serves
to declare schedule(). Then we can get rid of things that include
cyclic.h just to get that declaration.

A next, mostly mechanical step, could be to change almost all includes
of watchdog.h (which most TUs that used to have a WATCHDOG_RESET()
invocation has) to u-boot/schedule.h, because again, most of those TUs
are not really concerned with implementing init_func_watchdog_init or
need to call it. But that is for later.

CI seems happy: https://github.com/u-boot/u-boot/pull/673

Rasmus Villemoes (13):
  doc: cyclic: remove reference to WATCHDOG_RESET
  cyclic: introduce u-boot/schedule.h
  led: include cyclic.h in led_sw_blink.c
  m68k: asm/ptrace.h: include linux/types.h
  fs/cramfs: use schedule instead of cyclic_run as callback
  test: dm: wdt: replace cyclic_run() by schedule()
  cyclic: make cyclic_run static
  watchdog.h: change include of cyclic.h to u-boot/schedule.h
  lib/sha*: include u-boot/schedule.h instead of cyclic.h
  i2c: rzg2l: include u-boot/schedule.h
  ddr: altera: include u-boot/schedule.h
  boot: cedit: include u-boot/schedule.h
  global_data.h: remove unnecesary include of cyclic.h

 arch/m68k/include/asm/ptrace.h    |  2 ++
 boot/cedit.c                      |  1 +
 common/cyclic.c                   |  3 ++-
 doc/develop/cyclic.rst            | 10 +++++-----
 drivers/ddr/altera/sdram_n5x.c    |  1 +
 drivers/ddr/altera/sdram_soc64.c  |  1 +
 drivers/i2c/rz_riic.c             |  1 +
 drivers/led/led_sw_blink.c        |  1 +
 fs/cramfs/uncompress.c            |  4 ++--
 include/asm-generic/global_data.h |  1 -
 include/cyclic.h                  | 24 +-----------------------
 include/u-boot/schedule.h         | 24 ++++++++++++++++++++++++
 include/watchdog.h                |  2 +-
 lib/sha1.c                        |  2 +-
 lib/sha256.c                      |  2 +-
 lib/sha512.c                      |  2 +-
 test/dm/wdt.c                     | 10 +++++-----
 17 files changed, 50 insertions(+), 41 deletions(-)
 create mode 100644 include/u-boot/schedule.h

-- 
2.46.2


^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:10   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 02/13] cyclic: introduce u-boot/schedule.h Rasmus Villemoes
                   ` (13 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

WATCHDOG_RESET is no more. Replace the reference by schedule().

While here, rearrange the sentence a bit so that "cyclic_run()"
becomes the object and "the main function responsible for calling all
registered cyclic functions" a parenthetical rather than the other way
around, which at least to me makes it more readable.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 doc/develop/cyclic.rst | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/develop/cyclic.rst b/doc/develop/cyclic.rst
index 893c269099a..6f1da6f0d9b 100644
--- a/doc/develop/cyclic.rst
+++ b/doc/develop/cyclic.rst
@@ -49,8 +49,8 @@ executed all 10ms.
 How is this cyclic functionality integrated /  executed?
 --------------------------------------------------------
 
-The cyclic infrastructure 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.
+The cyclic infrastructure integrates cyclic_run(), the main function
+responsible for calling all registered cyclic functions, into the
+common schedule() function. 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.
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 02/13] cyclic: introduce u-boot/schedule.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
  2024-10-03 21:27 ` [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:11   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 03/13] led: include cyclic.h in led_sw_blink.c Rasmus Villemoes
                   ` (12 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

I noticed an "unnecessary" include of <cyclic.h> in
global_data.h, in the sense that nothing in cyclic.h is needed in
order to define 'struct global_data'.

Well, it's not unnecessary, as it implicitly ensures that everybody
gets a declaration of schedule(), and schedule() is (obviously) called
all over the tree. Almost none of those places directly include
<cyclic.h>, but for historical reasons, many do include
<watchdog.h> (most schedule() instances are replacements of
WATCHDOG_RESET()).

However, very few TUs actually need the declarations of the
cyclic_register() and struct cyclic_info, and they also don't really
need anything from the watchdog.h header.

So introduce a new header which just contains a declaration of
schedule(), which can then be included from all the places that do
call schedule(). I removed the direct reference to cyclic_run(),
because we shouldn't have two public functions for doing roughly the
same without being very explicit about when one should call one or the
other.

Testing of later patches that explicitly include <schedule.h> when
schedule() is used revealed a problem with host tool build on win32,
which apparently picked up a host <schedule.h>. To avoid that problem,
put the new header in include/u-boot/ and hence make the include
statements say <u-boot/schedule.h>.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 common/cyclic.c           |  1 +
 include/cyclic.h          | 12 +-----------
 include/u-boot/schedule.h | 24 ++++++++++++++++++++++++
 3 files changed, 26 insertions(+), 11 deletions(-)
 create mode 100644 include/u-boot/schedule.h

diff --git a/common/cyclic.c b/common/cyclic.c
index ec38fad6775..38d815bec35 100644
--- a/common/cyclic.c
+++ b/common/cyclic.c
@@ -15,6 +15,7 @@
 #include <linux/errno.h>
 #include <linux/list.h>
 #include <asm/global_data.h>
+#include <u-boot/schedule.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/include/cyclic.h b/include/cyclic.h
index cd95b691d48..e8de616dcd5 100644
--- a/include/cyclic.h
+++ b/include/cyclic.h
@@ -13,6 +13,7 @@
 
 #include <linux/list.h>
 #include <asm/types.h>
+#include <u-boot/schedule.h> // to be removed later
 
 /**
  * struct cyclic_info - Information about cyclic execution function
@@ -94,13 +95,6 @@ struct hlist_head *cyclic_get_list(void);
  */
 void cyclic_run(void);
 
-/**
- * schedule() - Schedule all potentially waiting tasks
- *
- * Basically a wrapper for cyclic_run(), pontentially enhanced by some
- * other parts, that need to get handled periodically.
- */
-void schedule(void);
 #else
 
 static inline void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
@@ -116,10 +110,6 @@ static inline void cyclic_run(void)
 {
 }
 
-static inline void schedule(void)
-{
-}
-
 static inline int cyclic_unregister_all(void)
 {
 	return 0;
diff --git a/include/u-boot/schedule.h b/include/u-boot/schedule.h
new file mode 100644
index 00000000000..4fd34c41229
--- /dev/null
+++ b/include/u-boot/schedule.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef _U_BOOT_SCHEDULE_H
+#define _U_BOOT_SCHEDULE_H
+
+#if CONFIG_IS_ENABLED(CYCLIC)
+/**
+ * schedule() - Schedule all potentially waiting tasks
+ *
+ * Run all pending tasks registered via the cyclic framework, and
+ * potentially perform other actions that need to be done
+ * periodically.
+ */
+void schedule(void);
+
+#else
+
+static inline void schedule(void)
+{
+}
+
+#endif
+
+#endif
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 03/13] led: include cyclic.h in led_sw_blink.c
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
  2024-10-03 21:27 ` [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET Rasmus Villemoes
  2024-10-03 21:27 ` [PATCH 02/13] cyclic: introduce u-boot/schedule.h Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:11   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h Rasmus Villemoes
                   ` (11 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

This makes use of the cyclic API but relies on implicitly getting the
appropriate declarations through some nested include. Include the
cyclic.h header directly.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 drivers/led/led_sw_blink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
index 9e36edbee47..6976b84544e 100644
--- a/drivers/led/led_sw_blink.c
+++ b/drivers/led/led_sw_blink.c
@@ -5,6 +5,7 @@
  * Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  */
 
+#include <cyclic.h>
 #include <dm.h>
 #include <led.h>
 #include <time.h>
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (2 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 03/13] led: include cyclic.h in led_sw_blink.c Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-04 17:14   ` Tom Rini
  2024-10-22 11:11   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback Rasmus Villemoes
                   ` (10 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

Modifying a generic header like watchdog.h, removing not directly used
#includes, can apparently break the build of m68k, because the
asm/ptrace.h header relies on whoever includes it to already have
included something that defines the type ulong.

Make the asm/ptrace.h header self-contained by including the proper
header.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 arch/m68k/include/asm/ptrace.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/m68k/include/asm/ptrace.h b/arch/m68k/include/asm/ptrace.h
index d419824806c..5decf73a1d1 100644
--- a/arch/m68k/include/asm/ptrace.h
+++ b/arch/m68k/include/asm/ptrace.h
@@ -9,6 +9,8 @@
  */
 #ifndef __ASSEMBLY__
 
+#include <linux/types.h>
+
 struct pt_regs {
 	ulong d0;
 	ulong d1;
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (3 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:11   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule() Rasmus Villemoes
                   ` (9 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

Prior to commit 29caf9305b6f ("cyclic: Use schedule() instead of
WATCHDOG_RESET()") we had

/* Currently only needed for fs/cramfs/uncompress.c */
static inline void watchdog_reset_func(void)
{
       WATCHDOG_RESET();
}

and .outcb was set to that watchdog_reset_func().  Said commit changed
that .outcb to cyclic_run instead of schedule, which would otherwise
match all the other WATCHDOG_RESET replacements done. As the
HW_WATCHDOG case is not handled by cyclic_run, this seems to be an
oversight.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 fs/cramfs/uncompress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c
index 2141edf22e4..97af8cb2b4f 100644
--- a/fs/cramfs/uncompress.c
+++ b/fs/cramfs/uncompress.c
@@ -21,9 +21,9 @@
  */
 
 #include <stdio.h>
-#include <cyclic.h>
 #include <malloc.h>
 #include <watchdog.h>
+#include <u-boot/schedule.h>
 #include <u-boot/zlib.h>
 
 static z_stream stream;
@@ -63,7 +63,7 @@ int cramfs_uncompress_init (void)
 	stream.avail_in = 0;
 
 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
-	stream.outcb = (cb_func)cyclic_run;
+	stream.outcb = (cb_func)schedule;
 #else
 	stream.outcb = Z_NULL;
 #endif /* CONFIG_HW_WATCHDOG */
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule()
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (4 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:12   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 07/13] cyclic: make cyclic_run static Rasmus Villemoes
                   ` (8 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

This is the last place outside of cyclic.c that references
cyclic_run() directly. Replace by schedule(), so that cyclic_run() can
be made private. This also better matches what I believe commit
29caf9305b6f ("cyclic: Use schedule() instead of WATCHDOG_RESET()")
intended to do.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 test/dm/wdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/dm/wdt.c b/test/dm/wdt.c
index 1df2da23c6c..4d751b7e8cf 100644
--- a/test/dm/wdt.c
+++ b/test/dm/wdt.c
@@ -3,7 +3,6 @@
  * Copyright 2017 Google, Inc
  */
 
-#include <cyclic.h>
 #include <dm.h>
 #include <time.h>
 #include <wdt.h>
@@ -14,6 +13,7 @@
 #include <test/test.h>
 #include <test/ut.h>
 #include <linux/delay.h>
+#include <u-boot/schedule.h>
 #include <watchdog.h>
 
 /* Test that watchdog driver functions are called */
@@ -131,7 +131,7 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
 	/* Neither device should be "started", so watchdog_reset() should be a no-op. */
 	reset_count = state->wdt.reset_count;
 	val = sandbox_gpio_get_value(gpio, offset);
-	cyclic_run();
+	schedule();
 	ut_asserteq(reset_count, state->wdt.reset_count);
 	ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
 
@@ -141,19 +141,19 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
 
 	/* Make sure both devices have just been pinged. */
 	timer_test_add_offset(100);
-	cyclic_run();
+	schedule();
 	reset_count = state->wdt.reset_count;
 	val = sandbox_gpio_get_value(gpio, offset);
 
 	/* The gpio watchdog should be pinged, the sandbox one not. */
 	timer_test_add_offset(30);
-	cyclic_run();
+	schedule();
 	ut_asserteq(reset_count, state->wdt.reset_count);
 	ut_asserteq(!val, sandbox_gpio_get_value(gpio, offset));
 
 	/* After another ~30ms, both devices should get pinged. */
 	timer_test_add_offset(30);
-	cyclic_run();
+	schedule();
 	ut_asserteq(reset_count + 1, state->wdt.reset_count);
 	ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
 
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 07/13] cyclic: make cyclic_run static
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (5 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule() Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:12   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h Rasmus Villemoes
                   ` (7 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

The only caller left is schedule(); everybody outside cyclic.c now
calls or references schedule().

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 common/cyclic.c  |  2 +-
 include/cyclic.h | 12 ------------
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/common/cyclic.c b/common/cyclic.c
index 38d815bec35..196797fd61e 100644
--- a/common/cyclic.c
+++ b/common/cyclic.c
@@ -45,7 +45,7 @@ void cyclic_unregister(struct cyclic_info *cyclic)
 	hlist_del(&cyclic->list);
 }
 
-void cyclic_run(void)
+static void cyclic_run(void)
 {
 	struct cyclic_info *cyclic;
 	struct hlist_node *tmp;
diff --git a/include/cyclic.h b/include/cyclic.h
index e8de616dcd5..c6c463d68e9 100644
--- a/include/cyclic.h
+++ b/include/cyclic.h
@@ -87,14 +87,6 @@ int cyclic_unregister_all(void);
  */
 struct hlist_head *cyclic_get_list(void);
 
-/**
- * cyclic_run() - Interate over all registered cyclic functions
- *
- * Interate over all registered cyclic functions and if the it's function
- * needs to be executed, then call into these registered functions.
- */
-void cyclic_run(void);
-
 #else
 
 static inline void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
@@ -106,10 +98,6 @@ static inline void cyclic_unregister(struct cyclic_info *cyclic)
 {
 }
 
-static inline void cyclic_run(void)
-{
-}
-
 static inline int cyclic_unregister_all(void)
 {
 	return 0;
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (6 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 07/13] cyclic: make cyclic_run static Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:12   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h Rasmus Villemoes
                   ` (6 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

Nobody relies on getting the cyclic API declared by including the
watchdog.h header, but for historical reasons, many TUs include
watchdog.h to get a declaration of schedule(). Now that we have a
dedicated header for just that, include that header instead of
cyclic.h.

Eventually, all TUs that call schedule() should themselves include
u-boot/schedule.h, but this is a step towards getting rid of
unnecessary include statements in cyclic.h and global_data.h.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 include/watchdog.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/watchdog.h b/include/watchdog.h
index d1956fafca1..0149b44d077 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -10,7 +10,7 @@
 #ifndef _WATCHDOG_H_
 #define _WATCHDOG_H_
 
-#include <cyclic.h>
+#include <u-boot/schedule.h> // to be removed later
 
 /*
  * Reset the watchdog timer, always returns 0
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (7 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  2024-10-03 21:27 ` [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h Rasmus Villemoes
                   ` (5 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

These library routines obviously do not make use of the
cyclic_register() etc. API, but do need to call schedule(). Include
the proper header.

Eventually, their ifdef logic should be updated to avoid talking about
CONFIG_WATCHDOG.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 lib/sha1.c   | 2 +-
 lib/sha256.c | 2 +-
 lib/sha512.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/sha1.c b/lib/sha1.c
index 7ef536f4b5d..233bd9145c6 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -17,7 +17,7 @@
 #endif
 
 #ifndef USE_HOSTCC
-#include <cyclic.h>
+#include <u-boot/schedule.h>
 #endif /* USE_HOSTCC */
 #include <string.h>
 #include <u-boot/sha1.h>
diff --git a/lib/sha256.c b/lib/sha256.c
index 665ba6f152e..329802fd827 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -6,7 +6,7 @@
  */
 
 #ifndef USE_HOSTCC
-#include <cyclic.h>
+#include <u-boot/schedule.h>
 #endif /* USE_HOSTCC */
 #include <string.h>
 #include <u-boot/sha256.h>
diff --git a/lib/sha512.c b/lib/sha512.c
index ffe2c5cd964..ea555ff33eb 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -11,7 +11,7 @@
  */
 
 #ifndef USE_HOSTCC
-#include <cyclic.h>
+#include <u-boot/schedule.h>
 #endif /* USE_HOSTCC */
 #include <compiler.h>
 #include <u-boot/sha512.h>
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (8 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h Rasmus Villemoes
@ 2024-10-03 21:27 ` Rasmus Villemoes
  2024-10-09  1:55   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  2024-10-03 21:28 ` [PATCH 11/13] ddr: altera: " Rasmus Villemoes
                   ` (4 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:27 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

This TU currently relies on getting a declaration of schedule()
through some nested include. Include the proper header directly.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 drivers/i2c/rz_riic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/rz_riic.c b/drivers/i2c/rz_riic.c
index 5f3f8d1b24b..f292c824362 100644
--- a/drivers/i2c/rz_riic.c
+++ b/drivers/i2c/rz_riic.c
@@ -14,6 +14,7 @@
 #include <linux/bitops.h>
 #include <linux/delay.h>
 #include <reset.h>
+#include <u-boot/schedule.h>
 #include <wait_bit.h>
 
 #define RIIC_ICCR1	0x00
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 11/13] ddr: altera: include u-boot/schedule.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (9 preceding siblings ...)
  2024-10-03 21:27 ` [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h Rasmus Villemoes
@ 2024-10-03 21:28 ` Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  2024-10-03 21:28 ` [PATCH 12/13] boot: cedit: " Rasmus Villemoes
                   ` (3 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:28 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

These TUs currently rely on getting a declaration of schedule()
through some nested include. Include the proper header directly.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 drivers/ddr/altera/sdram_n5x.c   | 1 +
 drivers/ddr/altera/sdram_soc64.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/ddr/altera/sdram_n5x.c b/drivers/ddr/altera/sdram_n5x.c
index db09986f64b..d1fc93b6bdd 100644
--- a/drivers/ddr/altera/sdram_n5x.c
+++ b/drivers/ddr/altera/sdram_n5x.c
@@ -22,6 +22,7 @@
 #include <asm/io.h>
 #include <linux/err.h>
 #include <linux/sizes.h>
+#include <u-boot/schedule.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c
index 9e57c2ecfa4..10a8e64af3d 100644
--- a/drivers/ddr/altera/sdram_soc64.c
+++ b/drivers/ddr/altera/sdram_soc64.c
@@ -24,6 +24,7 @@
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <linux/sizes.h>
+#include <u-boot/schedule.h>
 
 #define PGTABLE_OFF	0x4000
 
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 12/13] boot: cedit: include u-boot/schedule.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (10 preceding siblings ...)
  2024-10-03 21:28 ` [PATCH 11/13] ddr: altera: " Rasmus Villemoes
@ 2024-10-03 21:28 ` Rasmus Villemoes
  2024-10-09  1:51   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  2024-10-03 21:28 ` [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h Rasmus Villemoes
                   ` (2 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:28 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

This TU currently relies on getting a declaration of schedule()
through some nested include. Include the proper header directly.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 boot/cedit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/boot/cedit.c b/boot/cedit.c
index c29a2be14ce..ff0efda3a7b 100644
--- a/boot/cedit.c
+++ b/boot/cedit.c
@@ -20,6 +20,7 @@
 #include <video.h>
 #include <linux/delay.h>
 #include "scene_internal.h"
+#include <u-boot/schedule.h>
 
 enum {
 	CMOS_MAX_BITS	= 2048,
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (11 preceding siblings ...)
  2024-10-03 21:28 ` [PATCH 12/13] boot: cedit: " Rasmus Villemoes
@ 2024-10-03 21:28 ` Rasmus Villemoes
  2024-10-04 17:15   ` Tom Rini
  2024-10-22 11:14   ` Stefan Roese
  2024-10-04 11:20 ` [PATCH 00/13] disentangling cyclic API from schedule() Stefan Roese
  2024-10-23 10:53 ` Stefan Roese
  14 siblings, 2 replies; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-03 21:28 UTC (permalink / raw)
  To: u-boot; +Cc: Stefan Roese, Tom Rini, Rasmus Villemoes

Nothing in cyclic.h is needed to define struct global_data, so do not
include that header.

If any .c file relies on getting cyclic.h through asm/global_data.h,
it needs to include it itself.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 include/asm-generic/global_data.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 27aa75e7036..1570ad8f0c0 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -20,7 +20,6 @@
  */
 
 #ifndef __ASSEMBLY__
-#include <cyclic.h>
 #include <event_internal.h>
 #include <fdtdec.h>
 #include <membuff.h>
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/13] disentangling cyclic API from schedule()
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (12 preceding siblings ...)
  2024-10-03 21:28 ` [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h Rasmus Villemoes
@ 2024-10-04 11:20 ` Stefan Roese
  2024-10-23 10:53 ` Stefan Roese
  14 siblings, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-04 11:20 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

Hi Rasmus,

On 10/3/24 23:27, Rasmus Villemoes wrote:
> These patches are part of a longer-term plan to properly deal with the
> HW_WATCHDOG vs WATCHDOG dichotomy, and getting rid of the legacy
> HW_WATCHDOG concept completely. As part of that, clean up which
> headers include other headers.
> 
> While schedule(), the artist formerly known as WATCHDOG_RESET(), is
> obviously called all over the tree, very few TUs make use of the
> cyclic API (cyclic_register etc.). And there's really no reason at all
> for global_data.h to include cyclic.h - except that some places
> implicitly rely on getting their declaration of schedule() through
> that include.
> 
> So this introduces a separate mostly trivial header that just serves
> to declare schedule(). Then we can get rid of things that include
> cyclic.h just to get that declaration.
> 
> A next, mostly mechanical step, could be to change almost all includes
> of watchdog.h (which most TUs that used to have a WATCHDOG_RESET()
> invocation has) to u-boot/schedule.h, because again, most of those TUs
> are not really concerned with implementing init_func_watchdog_init or
> need to call it. But that is for later.
> 
> CI seems happy: https://github.com/u-boot/u-boot/pull/673
> 
> Rasmus Villemoes (13):
>    doc: cyclic: remove reference to WATCHDOG_RESET
>    cyclic: introduce u-boot/schedule.h
>    led: include cyclic.h in led_sw_blink.c
>    m68k: asm/ptrace.h: include linux/types.h
>    fs/cramfs: use schedule instead of cyclic_run as callback
>    test: dm: wdt: replace cyclic_run() by schedule()
>    cyclic: make cyclic_run static
>    watchdog.h: change include of cyclic.h to u-boot/schedule.h
>    lib/sha*: include u-boot/schedule.h instead of cyclic.h
>    i2c: rzg2l: include u-boot/schedule.h
>    ddr: altera: include u-boot/schedule.h
>    boot: cedit: include u-boot/schedule.h
>    global_data.h: remove unnecesary include of cyclic.h
> 
>   arch/m68k/include/asm/ptrace.h    |  2 ++
>   boot/cedit.c                      |  1 +
>   common/cyclic.c                   |  3 ++-
>   doc/develop/cyclic.rst            | 10 +++++-----
>   drivers/ddr/altera/sdram_n5x.c    |  1 +
>   drivers/ddr/altera/sdram_soc64.c  |  1 +
>   drivers/i2c/rz_riic.c             |  1 +
>   drivers/led/led_sw_blink.c        |  1 +
>   fs/cramfs/uncompress.c            |  4 ++--
>   include/asm-generic/global_data.h |  1 -
>   include/cyclic.h                  | 24 +-----------------------
>   include/u-boot/schedule.h         | 24 ++++++++++++++++++++++++
>   include/watchdog.h                |  2 +-
>   lib/sha1.c                        |  2 +-
>   lib/sha256.c                      |  2 +-
>   lib/sha512.c                      |  2 +-
>   test/dm/wdt.c                     | 10 +++++-----
>   17 files changed, 50 insertions(+), 41 deletions(-)
>   create mode 100644 include/u-boot/schedule.h

Thanks for this work - really appreciated. I'm leaving for vacation
pretty soon. Will take a closer look at these patches in roughly 2
weeks.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h
  2024-10-03 21:27 ` [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h Rasmus Villemoes
@ 2024-10-04 17:14   ` Tom Rini
  2024-10-22 11:11   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2024-10-04 17:14 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

On Thu, Oct 03, 2024 at 11:27:53PM +0200, Rasmus Villemoes wrote:

> Modifying a generic header like watchdog.h, removing not directly used
> #includes, can apparently break the build of m68k, because the
> asm/ptrace.h header relies on whoever includes it to already have
> included something that defines the type ulong.
> 
> Make the asm/ptrace.h header self-contained by including the proper
> header.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h
  2024-10-03 21:28 ` [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h Rasmus Villemoes
@ 2024-10-04 17:15   ` Tom Rini
  2024-10-22 11:14   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2024-10-04 17:15 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

On Thu, Oct 03, 2024 at 11:28:02PM +0200, Rasmus Villemoes wrote:

> Nothing in cyclic.h is needed to define struct global_data, so do not
> include that header.
> 
> If any .c file relies on getting cyclic.h through asm/global_data.h,
> it needs to include it itself.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 12/13] boot: cedit: include u-boot/schedule.h
  2024-10-03 21:28 ` [PATCH 12/13] boot: cedit: " Rasmus Villemoes
@ 2024-10-09  1:51   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:51 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:30, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> This TU currently relies on getting a declaration of schedule()
> through some nested include. Include the proper header directly.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  boot/cedit.c | 1 +
>  1 file changed, 1 insertion(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>



> diff --git a/boot/cedit.c b/boot/cedit.c
> index c29a2be14ce..ff0efda3a7b 100644
> --- a/boot/cedit.c
> +++ b/boot/cedit.c
> @@ -20,6 +20,7 @@
>  #include <video.h>
>  #include <linux/delay.h>
>  #include "scene_internal.h"
> +#include <u-boot/schedule.h>
>
>  enum {
>         CMOS_MAX_BITS   = 2048,
> --
> 2.46.2
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 11/13] ddr: altera: include u-boot/schedule.h
  2024-10-03 21:28 ` [PATCH 11/13] ddr: altera: " Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:30, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> These TUs currently rely on getting a declaration of schedule()
> through some nested include. Include the proper header directly.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  drivers/ddr/altera/sdram_n5x.c   | 1 +
>  drivers/ddr/altera/sdram_soc64.c | 1 +
>  2 files changed, 2 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>



>
> diff --git a/drivers/ddr/altera/sdram_n5x.c b/drivers/ddr/altera/sdram_n5x.c
> index db09986f64b..d1fc93b6bdd 100644
> --- a/drivers/ddr/altera/sdram_n5x.c
> +++ b/drivers/ddr/altera/sdram_n5x.c
> @@ -22,6 +22,7 @@
>  #include <asm/io.h>
>  #include <linux/err.h>
>  #include <linux/sizes.h>
> +#include <u-boot/schedule.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c
> index 9e57c2ecfa4..10a8e64af3d 100644
> --- a/drivers/ddr/altera/sdram_soc64.c
> +++ b/drivers/ddr/altera/sdram_soc64.c
> @@ -24,6 +24,7 @@
>  #include <asm/io.h>
>  #include <dm/device_compat.h>
>  #include <linux/sizes.h>
> +#include <u-boot/schedule.h>
>
>  #define PGTABLE_OFF    0x4000
>
> --
> 2.46.2
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET
  2024-10-03 21:27 ` [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:10   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:28, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> WATCHDOG_RESET is no more. Replace the reference by schedule().
>
> While here, rearrange the sentence a bit so that "cyclic_run()"
> becomes the object and "the main function responsible for calling all
> registered cyclic functions" a parenthetical rather than the other way
> around, which at least to me makes it more readable.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  doc/develop/cyclic.rst | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>



> diff --git a/doc/develop/cyclic.rst b/doc/develop/cyclic.rst
> index 893c269099a..6f1da6f0d9b 100644
> --- a/doc/develop/cyclic.rst
> +++ b/doc/develop/cyclic.rst
> @@ -49,8 +49,8 @@ executed all 10ms.
>  How is this cyclic functionality integrated /  executed?
>  --------------------------------------------------------
>
> -The cyclic infrastructure 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.
> +The cyclic infrastructure integrates cyclic_run(), the main function
> +responsible for calling all registered cyclic functions, into the
> +common schedule() function. 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.
> --
> 2.46.2
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h
  2024-10-03 21:27 ` [PATCH 02/13] cyclic: introduce u-boot/schedule.h Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-09 11:08     ` Rasmus Villemoes
  2024-10-22 11:11   ` Stefan Roese
  1 sibling, 1 reply; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:28, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> I noticed an "unnecessary" include of <cyclic.h> in
> global_data.h, in the sense that nothing in cyclic.h is needed in
> order to define 'struct global_data'.
>
> Well, it's not unnecessary, as it implicitly ensures that everybody
> gets a declaration of schedule(), and schedule() is (obviously) called
> all over the tree. Almost none of those places directly include
> <cyclic.h>, but for historical reasons, many do include
> <watchdog.h> (most schedule() instances are replacements of
> WATCHDOG_RESET()).
>
> However, very few TUs actually need the declarations of the
> cyclic_register() and struct cyclic_info, and they also don't really
> need anything from the watchdog.h header.
>
> So introduce a new header which just contains a declaration of
> schedule(), which can then be included from all the places that do
> call schedule(). I removed the direct reference to cyclic_run(),
> because we shouldn't have two public functions for doing roughly the
> same without being very explicit about when one should call one or the
> other.
>
> Testing of later patches that explicitly include <schedule.h> when
> schedule() is used revealed a problem with host tool build on win32,
> which apparently picked up a host <schedule.h>. To avoid that problem,
> put the new header in include/u-boot/ and hence make the include
> statements say <u-boot/schedule.h>.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  common/cyclic.c           |  1 +
>  include/cyclic.h          | 12 +-----------
>  include/u-boot/schedule.h | 24 ++++++++++++++++++++++++
>  3 files changed, 26 insertions(+), 11 deletions(-)
>  create mode 100644 include/u-boot/schedule.h

Reviewed-by: Simon Glass <sjg@chromium.org>

But could it just be include/schedule.h ?

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 03/13] led: include cyclic.h in led_sw_blink.c
  2024-10-03 21:27 ` [PATCH 03/13] led: include cyclic.h in led_sw_blink.c Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:11   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:28, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> This makes use of the cyclic API but relies on implicitly getting the
> appropriate declarations through some nested include. Include the
> cyclic.h header directly.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  drivers/led/led_sw_blink.c | 1 +
>  1 file changed, 1 insertion(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>



> diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
> index 9e36edbee47..6976b84544e 100644
> --- a/drivers/led/led_sw_blink.c
> +++ b/drivers/led/led_sw_blink.c
> @@ -5,6 +5,7 @@
>   * Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
>   */
>
> +#include <cyclic.h>
>  #include <dm.h>
>  #include <led.h>
>  #include <time.h>
> --
> 2.46.2
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback
  2024-10-03 21:27 ` [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:11   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:29, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> Prior to commit 29caf9305b6f ("cyclic: Use schedule() instead of
> WATCHDOG_RESET()") we had
>
> /* Currently only needed for fs/cramfs/uncompress.c */
> static inline void watchdog_reset_func(void)
> {
>        WATCHDOG_RESET();
> }
>
> and .outcb was set to that watchdog_reset_func().  Said commit changed
> that .outcb to cyclic_run instead of schedule, which would otherwise
> match all the other WATCHDOG_RESET replacements done. As the
> HW_WATCHDOG case is not handled by cyclic_run, this seems to be an
> oversight.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  fs/cramfs/uncompress.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>



>
> diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c
> index 2141edf22e4..97af8cb2b4f 100644
> --- a/fs/cramfs/uncompress.c
> +++ b/fs/cramfs/uncompress.c
> @@ -21,9 +21,9 @@
>   */
>
>  #include <stdio.h>
> -#include <cyclic.h>
>  #include <malloc.h>
>  #include <watchdog.h>
> +#include <u-boot/schedule.h>
>  #include <u-boot/zlib.h>
>
>  static z_stream stream;
> @@ -63,7 +63,7 @@ int cramfs_uncompress_init (void)
>         stream.avail_in = 0;
>
>  #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
> -       stream.outcb = (cb_func)cyclic_run;
> +       stream.outcb = (cb_func)schedule;
>  #else
>         stream.outcb = Z_NULL;
>  #endif /* CONFIG_HW_WATCHDOG */
> --
> 2.46.2
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule()
  2024-10-03 21:27 ` [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule() Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:12   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:29, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> This is the last place outside of cyclic.c that references
> cyclic_run() directly. Replace by schedule(), so that cyclic_run() can
> be made private. This also better matches what I believe commit
> 29caf9305b6f ("cyclic: Use schedule() instead of WATCHDOG_RESET()")
> intended to do.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  test/dm/wdt.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/13] cyclic: make cyclic_run static
  2024-10-03 21:27 ` [PATCH 07/13] cyclic: make cyclic_run static Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:12   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:29, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> The only caller left is schedule(); everybody outside cyclic.c now
> calls or references schedule().
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  common/cyclic.c  |  2 +-
>  include/cyclic.h | 12 ------------
>  2 files changed, 1 insertion(+), 13 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h
  2024-10-03 21:27 ` [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:12   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:29, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> Nobody relies on getting the cyclic API declared by including the
> watchdog.h header, but for historical reasons, many TUs include
> watchdog.h to get a declaration of schedule(). Now that we have a
> dedicated header for just that, include that header instead of
> cyclic.h.
>
> Eventually, all TUs that call schedule() should themselves include
> u-boot/schedule.h, but this is a step towards getting rid of
> unnecessary include statements in cyclic.h and global_data.h.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  include/watchdog.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h
  2024-10-03 21:27 ` [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h Rasmus Villemoes
@ 2024-10-09  1:52   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:52 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:29, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> These library routines obviously do not make use of the
> cyclic_register() etc. API, but do need to call schedule(). Include
> the proper header.
>
> Eventually, their ifdef logic should be updated to avoid talking about
> CONFIG_WATCHDOG.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  lib/sha1.c   | 2 +-
>  lib/sha256.c | 2 +-
>  lib/sha512.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h
  2024-10-03 21:27 ` [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h Rasmus Villemoes
@ 2024-10-09  1:55   ` Simon Glass
  2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09  1:55 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

On Thu, 3 Oct 2024 at 15:29, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> This TU currently relies on getting a declaration of schedule()
> through some nested include. Include the proper header directly.
>
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
> ---
>  drivers/i2c/rz_riic.c | 1 +
>  1 file changed, 1 insertion(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

> diff --git a/drivers/i2c/rz_riic.c b/drivers/i2c/rz_riic.c
> index 5f3f8d1b24b..f292c824362 100644
> --- a/drivers/i2c/rz_riic.c
> +++ b/drivers/i2c/rz_riic.c
> @@ -14,6 +14,7 @@
>  #include <linux/bitops.h>
>  #include <linux/delay.h>
>  #include <reset.h>
> +#include <u-boot/schedule.h>
>  #include <wait_bit.h>

dodgy header-order here, although it predates this patch.




>
>  #define RIIC_ICCR1     0x00
> --
> 2.46.2
>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-09 11:08     ` Rasmus Villemoes
  2024-10-09 21:13       ` Simon Glass
  0 siblings, 1 reply; 44+ messages in thread
From: Rasmus Villemoes @ 2024-10-09 11:08 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot, Stefan Roese, Tom Rini

Simon Glass <sjg@chromium.org> writes:

> On Thu, 3 Oct 2024 at 15:28, Rasmus Villemoes <ravi@prevas.dk> wrote:

>>  common/cyclic.c           |  1 +
>>  include/cyclic.h          | 12 +-----------
>>  include/u-boot/schedule.h | 24 ++++++++++++++++++++++++
>>  3 files changed, 26 insertions(+), 11 deletions(-)
>>  create mode 100644 include/u-boot/schedule.h
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> But could it just be include/schedule.h ?

I think the last paragraph in the commit message should answer that:

>> Testing of later patches that explicitly include <schedule.h> when
>> schedule() is used revealed a problem with host tool build on win32,
>> which apparently picked up a host <schedule.h>. To avoid that problem,
>> put the new header in include/u-boot/ and hence make the include
>> statements say <u-boot/schedule.h>.

So I tried that at first, and it worked fine for all my local builds,
but the CI told me it couldn't. I can try to find the old github PR
where I got the CI to tell me this (it's months ago I started doing
this), but I don't know if the azure logs still exist.

Rasmus

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h
  2024-10-09 11:08     ` Rasmus Villemoes
@ 2024-10-09 21:13       ` Simon Glass
  0 siblings, 0 replies; 44+ messages in thread
From: Simon Glass @ 2024-10-09 21:13 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot, Stefan Roese, Tom Rini

Hi Rasmus,

On Wed, 9 Oct 2024 at 05:08, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> Simon Glass <sjg@chromium.org> writes:
>
> > On Thu, 3 Oct 2024 at 15:28, Rasmus Villemoes <ravi@prevas.dk> wrote:
>
> >>  common/cyclic.c           |  1 +
> >>  include/cyclic.h          | 12 +-----------
> >>  include/u-boot/schedule.h | 24 ++++++++++++++++++++++++
> >>  3 files changed, 26 insertions(+), 11 deletions(-)
> >>  create mode 100644 include/u-boot/schedule.h
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > But could it just be include/schedule.h ?
>
> I think the last paragraph in the commit message should answer that:
>
> >> Testing of later patches that explicitly include <schedule.h> when
> >> schedule() is used revealed a problem with host tool build on win32,
> >> which apparently picked up a host <schedule.h>. To avoid that problem,
> >> put the new header in include/u-boot/ and hence make the include
> >> statements say <u-boot/schedule.h>.
>
> So I tried that at first, and it worked fine for all my local builds,
> but the CI told me it couldn't. I can try to find the old github PR
> where I got the CI to tell me this (it's months ago I started doing
> this), but I don't know if the azure logs still exist.

Ah yes, thanks.

Regards,
Simon

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET
  2024-10-03 21:27 ` [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:10   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:10 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> WATCHDOG_RESET is no more. Replace the reference by schedule().
> 
> While here, rearrange the sentence a bit so that "cyclic_run()"
> becomes the object and "the main function responsible for calling all
> registered cyclic functions" a parenthetical rather than the other way
> around, which at least to me makes it more readable.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   doc/develop/cyclic.rst | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/develop/cyclic.rst b/doc/develop/cyclic.rst
> index 893c269099a..6f1da6f0d9b 100644
> --- a/doc/develop/cyclic.rst
> +++ b/doc/develop/cyclic.rst
> @@ -49,8 +49,8 @@ executed all 10ms.
>   How is this cyclic functionality integrated /  executed?
>   --------------------------------------------------------
>   
> -The cyclic infrastructure 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.
> +The cyclic infrastructure integrates cyclic_run(), the main function
> +responsible for calling all registered cyclic functions, into the
> +common schedule() function. 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.

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h
  2024-10-03 21:27 ` [PATCH 02/13] cyclic: introduce u-boot/schedule.h Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:11   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:11 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> I noticed an "unnecessary" include of <cyclic.h> in
> global_data.h, in the sense that nothing in cyclic.h is needed in
> order to define 'struct global_data'.
> 
> Well, it's not unnecessary, as it implicitly ensures that everybody
> gets a declaration of schedule(), and schedule() is (obviously) called
> all over the tree. Almost none of those places directly include
> <cyclic.h>, but for historical reasons, many do include
> <watchdog.h> (most schedule() instances are replacements of
> WATCHDOG_RESET()).
> 
> However, very few TUs actually need the declarations of the
> cyclic_register() and struct cyclic_info, and they also don't really
> need anything from the watchdog.h header.
> 
> So introduce a new header which just contains a declaration of
> schedule(), which can then be included from all the places that do
> call schedule(). I removed the direct reference to cyclic_run(),
> because we shouldn't have two public functions for doing roughly the
> same without being very explicit about when one should call one or the
> other.
> 
> Testing of later patches that explicitly include <schedule.h> when
> schedule() is used revealed a problem with host tool build on win32,
> which apparently picked up a host <schedule.h>. To avoid that problem,
> put the new header in include/u-boot/ and hence make the include
> statements say <u-boot/schedule.h>.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   common/cyclic.c           |  1 +
>   include/cyclic.h          | 12 +-----------
>   include/u-boot/schedule.h | 24 ++++++++++++++++++++++++
>   3 files changed, 26 insertions(+), 11 deletions(-)
>   create mode 100644 include/u-boot/schedule.h
> 
> diff --git a/common/cyclic.c b/common/cyclic.c
> index ec38fad6775..38d815bec35 100644
> --- a/common/cyclic.c
> +++ b/common/cyclic.c
> @@ -15,6 +15,7 @@
>   #include <linux/errno.h>
>   #include <linux/list.h>
>   #include <asm/global_data.h>
> +#include <u-boot/schedule.h>
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   
> diff --git a/include/cyclic.h b/include/cyclic.h
> index cd95b691d48..e8de616dcd5 100644
> --- a/include/cyclic.h
> +++ b/include/cyclic.h
> @@ -13,6 +13,7 @@
>   
>   #include <linux/list.h>
>   #include <asm/types.h>
> +#include <u-boot/schedule.h> // to be removed later
>   
>   /**
>    * struct cyclic_info - Information about cyclic execution function
> @@ -94,13 +95,6 @@ struct hlist_head *cyclic_get_list(void);
>    */
>   void cyclic_run(void);
>   
> -/**
> - * schedule() - Schedule all potentially waiting tasks
> - *
> - * Basically a wrapper for cyclic_run(), pontentially enhanced by some
> - * other parts, that need to get handled periodically.
> - */
> -void schedule(void);
>   #else
>   
>   static inline void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
> @@ -116,10 +110,6 @@ static inline void cyclic_run(void)
>   {
>   }
>   
> -static inline void schedule(void)
> -{
> -}
> -
>   static inline int cyclic_unregister_all(void)
>   {
>   	return 0;
> diff --git a/include/u-boot/schedule.h b/include/u-boot/schedule.h
> new file mode 100644
> index 00000000000..4fd34c41229
> --- /dev/null
> +++ b/include/u-boot/schedule.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +
> +#ifndef _U_BOOT_SCHEDULE_H
> +#define _U_BOOT_SCHEDULE_H
> +
> +#if CONFIG_IS_ENABLED(CYCLIC)
> +/**
> + * schedule() - Schedule all potentially waiting tasks
> + *
> + * Run all pending tasks registered via the cyclic framework, and
> + * potentially perform other actions that need to be done
> + * periodically.
> + */
> +void schedule(void);
> +
> +#else
> +
> +static inline void schedule(void)
> +{
> +}
> +
> +#endif
> +
> +#endif

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 03/13] led: include cyclic.h in led_sw_blink.c
  2024-10-03 21:27 ` [PATCH 03/13] led: include cyclic.h in led_sw_blink.c Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:11   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:11 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> This makes use of the cyclic API but relies on implicitly getting the
> appropriate declarations through some nested include. Include the
> cyclic.h header directly.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/led/led_sw_blink.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c
> index 9e36edbee47..6976b84544e 100644
> --- a/drivers/led/led_sw_blink.c
> +++ b/drivers/led/led_sw_blink.c
> @@ -5,6 +5,7 @@
>    * Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
>    */
>   
> +#include <cyclic.h>
>   #include <dm.h>
>   #include <led.h>
>   #include <time.h>

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h
  2024-10-03 21:27 ` [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h Rasmus Villemoes
  2024-10-04 17:14   ` Tom Rini
@ 2024-10-22 11:11   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:11 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> Modifying a generic header like watchdog.h, removing not directly used
> #includes, can apparently break the build of m68k, because the
> asm/ptrace.h header relies on whoever includes it to already have
> included something that defines the type ulong.
> 
> Make the asm/ptrace.h header self-contained by including the proper
> header.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   arch/m68k/include/asm/ptrace.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/m68k/include/asm/ptrace.h b/arch/m68k/include/asm/ptrace.h
> index d419824806c..5decf73a1d1 100644
> --- a/arch/m68k/include/asm/ptrace.h
> +++ b/arch/m68k/include/asm/ptrace.h
> @@ -9,6 +9,8 @@
>    */
>   #ifndef __ASSEMBLY__
>   
> +#include <linux/types.h>
> +
>   struct pt_regs {
>   	ulong d0;
>   	ulong d1;

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback
  2024-10-03 21:27 ` [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:11   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:11 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> Prior to commit 29caf9305b6f ("cyclic: Use schedule() instead of
> WATCHDOG_RESET()") we had
> 
> /* Currently only needed for fs/cramfs/uncompress.c */
> static inline void watchdog_reset_func(void)
> {
>         WATCHDOG_RESET();
> }
> 
> and .outcb was set to that watchdog_reset_func().  Said commit changed
> that .outcb to cyclic_run instead of schedule, which would otherwise
> match all the other WATCHDOG_RESET replacements done. As the
> HW_WATCHDOG case is not handled by cyclic_run, this seems to be an
> oversight.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   fs/cramfs/uncompress.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c
> index 2141edf22e4..97af8cb2b4f 100644
> --- a/fs/cramfs/uncompress.c
> +++ b/fs/cramfs/uncompress.c
> @@ -21,9 +21,9 @@
>    */
>   
>   #include <stdio.h>
> -#include <cyclic.h>
>   #include <malloc.h>
>   #include <watchdog.h>
> +#include <u-boot/schedule.h>
>   #include <u-boot/zlib.h>
>   
>   static z_stream stream;
> @@ -63,7 +63,7 @@ int cramfs_uncompress_init (void)
>   	stream.avail_in = 0;
>   
>   #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
> -	stream.outcb = (cb_func)cyclic_run;
> +	stream.outcb = (cb_func)schedule;
>   #else
>   	stream.outcb = Z_NULL;
>   #endif /* CONFIG_HW_WATCHDOG */

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule()
  2024-10-03 21:27 ` [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule() Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:12   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:12 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> This is the last place outside of cyclic.c that references
> cyclic_run() directly. Replace by schedule(), so that cyclic_run() can
> be made private. This also better matches what I believe commit
> 29caf9305b6f ("cyclic: Use schedule() instead of WATCHDOG_RESET()")
> intended to do.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   test/dm/wdt.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/test/dm/wdt.c b/test/dm/wdt.c
> index 1df2da23c6c..4d751b7e8cf 100644
> --- a/test/dm/wdt.c
> +++ b/test/dm/wdt.c
> @@ -3,7 +3,6 @@
>    * Copyright 2017 Google, Inc
>    */
>   
> -#include <cyclic.h>
>   #include <dm.h>
>   #include <time.h>
>   #include <wdt.h>
> @@ -14,6 +13,7 @@
>   #include <test/test.h>
>   #include <test/ut.h>
>   #include <linux/delay.h>
> +#include <u-boot/schedule.h>
>   #include <watchdog.h>
>   
>   /* Test that watchdog driver functions are called */
> @@ -131,7 +131,7 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
>   	/* Neither device should be "started", so watchdog_reset() should be a no-op. */
>   	reset_count = state->wdt.reset_count;
>   	val = sandbox_gpio_get_value(gpio, offset);
> -	cyclic_run();
> +	schedule();
>   	ut_asserteq(reset_count, state->wdt.reset_count);
>   	ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
>   
> @@ -141,19 +141,19 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
>   
>   	/* Make sure both devices have just been pinged. */
>   	timer_test_add_offset(100);
> -	cyclic_run();
> +	schedule();
>   	reset_count = state->wdt.reset_count;
>   	val = sandbox_gpio_get_value(gpio, offset);
>   
>   	/* The gpio watchdog should be pinged, the sandbox one not. */
>   	timer_test_add_offset(30);
> -	cyclic_run();
> +	schedule();
>   	ut_asserteq(reset_count, state->wdt.reset_count);
>   	ut_asserteq(!val, sandbox_gpio_get_value(gpio, offset));
>   
>   	/* After another ~30ms, both devices should get pinged. */
>   	timer_test_add_offset(30);
> -	cyclic_run();
> +	schedule();
>   	ut_asserteq(reset_count + 1, state->wdt.reset_count);
>   	ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
>   

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/13] cyclic: make cyclic_run static
  2024-10-03 21:27 ` [PATCH 07/13] cyclic: make cyclic_run static Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:12   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:12 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> The only caller left is schedule(); everybody outside cyclic.c now
> calls or references schedule().
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   common/cyclic.c  |  2 +-
>   include/cyclic.h | 12 ------------
>   2 files changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/common/cyclic.c b/common/cyclic.c
> index 38d815bec35..196797fd61e 100644
> --- a/common/cyclic.c
> +++ b/common/cyclic.c
> @@ -45,7 +45,7 @@ void cyclic_unregister(struct cyclic_info *cyclic)
>   	hlist_del(&cyclic->list);
>   }
>   
> -void cyclic_run(void)
> +static void cyclic_run(void)
>   {
>   	struct cyclic_info *cyclic;
>   	struct hlist_node *tmp;
> diff --git a/include/cyclic.h b/include/cyclic.h
> index e8de616dcd5..c6c463d68e9 100644
> --- a/include/cyclic.h
> +++ b/include/cyclic.h
> @@ -87,14 +87,6 @@ int cyclic_unregister_all(void);
>    */
>   struct hlist_head *cyclic_get_list(void);
>   
> -/**
> - * cyclic_run() - Interate over all registered cyclic functions
> - *
> - * Interate over all registered cyclic functions and if the it's function
> - * needs to be executed, then call into these registered functions.
> - */
> -void cyclic_run(void);
> -
>   #else
>   
>   static inline void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func,
> @@ -106,10 +98,6 @@ static inline void cyclic_unregister(struct cyclic_info *cyclic)
>   {
>   }
>   
> -static inline void cyclic_run(void)
> -{
> -}
> -
>   static inline int cyclic_unregister_all(void)
>   {
>   	return 0;

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h
  2024-10-03 21:27 ` [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:12   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:12 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> Nobody relies on getting the cyclic API declared by including the
> watchdog.h header, but for historical reasons, many TUs include
> watchdog.h to get a declaration of schedule(). Now that we have a
> dedicated header for just that, include that header instead of
> cyclic.h.
> 
> Eventually, all TUs that call schedule() should themselves include
> u-boot/schedule.h, but this is a step towards getting rid of
> unnecessary include statements in cyclic.h and global_data.h.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   include/watchdog.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/watchdog.h b/include/watchdog.h
> index d1956fafca1..0149b44d077 100644
> --- a/include/watchdog.h
> +++ b/include/watchdog.h
> @@ -10,7 +10,7 @@
>   #ifndef _WATCHDOG_H_
>   #define _WATCHDOG_H_
>   
> -#include <cyclic.h>
> +#include <u-boot/schedule.h> // to be removed later
>   
>   /*
>    * Reset the watchdog timer, always returns 0

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h
  2024-10-03 21:27 ` [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:13 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> These library routines obviously do not make use of the
> cyclic_register() etc. API, but do need to call schedule(). Include
> the proper header.
> 
> Eventually, their ifdef logic should be updated to avoid talking about
> CONFIG_WATCHDOG.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   lib/sha1.c   | 2 +-
>   lib/sha256.c | 2 +-
>   lib/sha512.c | 2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/sha1.c b/lib/sha1.c
> index 7ef536f4b5d..233bd9145c6 100644
> --- a/lib/sha1.c
> +++ b/lib/sha1.c
> @@ -17,7 +17,7 @@
>   #endif
>   
>   #ifndef USE_HOSTCC
> -#include <cyclic.h>
> +#include <u-boot/schedule.h>
>   #endif /* USE_HOSTCC */
>   #include <string.h>
>   #include <u-boot/sha1.h>
> diff --git a/lib/sha256.c b/lib/sha256.c
> index 665ba6f152e..329802fd827 100644
> --- a/lib/sha256.c
> +++ b/lib/sha256.c
> @@ -6,7 +6,7 @@
>    */
>   
>   #ifndef USE_HOSTCC
> -#include <cyclic.h>
> +#include <u-boot/schedule.h>
>   #endif /* USE_HOSTCC */
>   #include <string.h>
>   #include <u-boot/sha256.h>
> diff --git a/lib/sha512.c b/lib/sha512.c
> index ffe2c5cd964..ea555ff33eb 100644
> --- a/lib/sha512.c
> +++ b/lib/sha512.c
> @@ -11,7 +11,7 @@
>    */
>   
>   #ifndef USE_HOSTCC
> -#include <cyclic.h>
> +#include <u-boot/schedule.h>
>   #endif /* USE_HOSTCC */
>   #include <compiler.h>
>   #include <u-boot/sha512.h>

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h
  2024-10-03 21:27 ` [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h Rasmus Villemoes
  2024-10-09  1:55   ` Simon Glass
@ 2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:13 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> This TU currently relies on getting a declaration of schedule()
> through some nested include. Include the proper header directly.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/i2c/rz_riic.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/i2c/rz_riic.c b/drivers/i2c/rz_riic.c
> index 5f3f8d1b24b..f292c824362 100644
> --- a/drivers/i2c/rz_riic.c
> +++ b/drivers/i2c/rz_riic.c
> @@ -14,6 +14,7 @@
>   #include <linux/bitops.h>
>   #include <linux/delay.h>
>   #include <reset.h>
> +#include <u-boot/schedule.h>
>   #include <wait_bit.h>
>   
>   #define RIIC_ICCR1	0x00

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 11/13] ddr: altera: include u-boot/schedule.h
  2024-10-03 21:28 ` [PATCH 11/13] ddr: altera: " Rasmus Villemoes
  2024-10-09  1:52   ` Simon Glass
@ 2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:13 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:28, Rasmus Villemoes wrote:
> These TUs currently rely on getting a declaration of schedule()
> through some nested include. Include the proper header directly.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/ddr/altera/sdram_n5x.c   | 1 +
>   drivers/ddr/altera/sdram_soc64.c | 1 +
>   2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/ddr/altera/sdram_n5x.c b/drivers/ddr/altera/sdram_n5x.c
> index db09986f64b..d1fc93b6bdd 100644
> --- a/drivers/ddr/altera/sdram_n5x.c
> +++ b/drivers/ddr/altera/sdram_n5x.c
> @@ -22,6 +22,7 @@
>   #include <asm/io.h>
>   #include <linux/err.h>
>   #include <linux/sizes.h>
> +#include <u-boot/schedule.h>
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   
> diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c
> index 9e57c2ecfa4..10a8e64af3d 100644
> --- a/drivers/ddr/altera/sdram_soc64.c
> +++ b/drivers/ddr/altera/sdram_soc64.c
> @@ -24,6 +24,7 @@
>   #include <asm/io.h>
>   #include <dm/device_compat.h>
>   #include <linux/sizes.h>
> +#include <u-boot/schedule.h>
>   
>   #define PGTABLE_OFF	0x4000
>   

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 12/13] boot: cedit: include u-boot/schedule.h
  2024-10-03 21:28 ` [PATCH 12/13] boot: cedit: " Rasmus Villemoes
  2024-10-09  1:51   ` Simon Glass
@ 2024-10-22 11:13   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:13 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:28, Rasmus Villemoes wrote:
> This TU currently relies on getting a declaration of schedule()
> through some nested include. Include the proper header directly.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   boot/cedit.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/boot/cedit.c b/boot/cedit.c
> index c29a2be14ce..ff0efda3a7b 100644
> --- a/boot/cedit.c
> +++ b/boot/cedit.c
> @@ -20,6 +20,7 @@
>   #include <video.h>
>   #include <linux/delay.h>
>   #include "scene_internal.h"
> +#include <u-boot/schedule.h>
>   
>   enum {
>   	CMOS_MAX_BITS	= 2048,

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h
  2024-10-03 21:28 ` [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h Rasmus Villemoes
  2024-10-04 17:15   ` Tom Rini
@ 2024-10-22 11:14   ` Stefan Roese
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-22 11:14 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:28, Rasmus Villemoes wrote:
> Nothing in cyclic.h is needed to define struct global_data, so do not
> include that header.
> 
> If any .c file relies on getting cyclic.h through asm/global_data.h,
> it needs to include it itself.
> 
> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   include/asm-generic/global_data.h | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index 27aa75e7036..1570ad8f0c0 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -20,7 +20,6 @@
>    */
>   
>   #ifndef __ASSEMBLY__
> -#include <cyclic.h>
>   #include <event_internal.h>
>   #include <fdtdec.h>
>   #include <membuff.h>

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/13] disentangling cyclic API from schedule()
  2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
                   ` (13 preceding siblings ...)
  2024-10-04 11:20 ` [PATCH 00/13] disentangling cyclic API from schedule() Stefan Roese
@ 2024-10-23 10:53 ` Stefan Roese
  14 siblings, 0 replies; 44+ messages in thread
From: Stefan Roese @ 2024-10-23 10:53 UTC (permalink / raw)
  To: Rasmus Villemoes, u-boot; +Cc: Tom Rini

On 10/3/24 23:27, Rasmus Villemoes wrote:
> These patches are part of a longer-term plan to properly deal with the
> HW_WATCHDOG vs WATCHDOG dichotomy, and getting rid of the legacy
> HW_WATCHDOG concept completely. As part of that, clean up which
> headers include other headers.
> 
> While schedule(), the artist formerly known as WATCHDOG_RESET(), is
> obviously called all over the tree, very few TUs make use of the
> cyclic API (cyclic_register etc.). And there's really no reason at all
> for global_data.h to include cyclic.h - except that some places
> implicitly rely on getting their declaration of schedule() through
> that include.
> 
> So this introduces a separate mostly trivial header that just serves
> to declare schedule(). Then we can get rid of things that include
> cyclic.h just to get that declaration.
> 
> A next, mostly mechanical step, could be to change almost all includes
> of watchdog.h (which most TUs that used to have a WATCHDOG_RESET()
> invocation has) to u-boot/schedule.h, because again, most of those TUs
> are not really concerned with implementing init_func_watchdog_init or
> need to call it. But that is for later.
> 
> CI seems happy: https://github.com/u-boot/u-boot/pull/673
> 
> Rasmus Villemoes (13):
>    doc: cyclic: remove reference to WATCHDOG_RESET
>    cyclic: introduce u-boot/schedule.h
>    led: include cyclic.h in led_sw_blink.c
>    m68k: asm/ptrace.h: include linux/types.h
>    fs/cramfs: use schedule instead of cyclic_run as callback
>    test: dm: wdt: replace cyclic_run() by schedule()
>    cyclic: make cyclic_run static
>    watchdog.h: change include of cyclic.h to u-boot/schedule.h
>    lib/sha*: include u-boot/schedule.h instead of cyclic.h
>    i2c: rzg2l: include u-boot/schedule.h
>    ddr: altera: include u-boot/schedule.h
>    boot: cedit: include u-boot/schedule.h
>    global_data.h: remove unnecesary include of cyclic.h
> 
>   arch/m68k/include/asm/ptrace.h    |  2 ++
>   boot/cedit.c                      |  1 +
>   common/cyclic.c                   |  3 ++-
>   doc/develop/cyclic.rst            | 10 +++++-----
>   drivers/ddr/altera/sdram_n5x.c    |  1 +
>   drivers/ddr/altera/sdram_soc64.c  |  1 +
>   drivers/i2c/rz_riic.c             |  1 +
>   drivers/led/led_sw_blink.c        |  1 +
>   fs/cramfs/uncompress.c            |  4 ++--
>   include/asm-generic/global_data.h |  1 -
>   include/cyclic.h                  | 24 +-----------------------
>   include/u-boot/schedule.h         | 24 ++++++++++++++++++++++++
>   include/watchdog.h                |  2 +-
>   lib/sha1.c                        |  2 +-
>   lib/sha256.c                      |  2 +-
>   lib/sha512.c                      |  2 +-
>   test/dm/wdt.c                     | 10 +++++-----
>   17 files changed, 50 insertions(+), 41 deletions(-)
>   create mode 100644 include/u-boot/schedule.h
> 

Applied to u-boot-watchdog/master

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2024-10-23 10:53 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-03 21:27 [PATCH 00/13] disentangling cyclic API from schedule() Rasmus Villemoes
2024-10-03 21:27 ` [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:10   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 02/13] cyclic: introduce u-boot/schedule.h Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-09 11:08     ` Rasmus Villemoes
2024-10-09 21:13       ` Simon Glass
2024-10-22 11:11   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 03/13] led: include cyclic.h in led_sw_blink.c Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:11   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h Rasmus Villemoes
2024-10-04 17:14   ` Tom Rini
2024-10-22 11:11   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:11   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule() Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:12   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 07/13] cyclic: make cyclic_run static Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:12   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:12   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:13   ` Stefan Roese
2024-10-03 21:27 ` [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h Rasmus Villemoes
2024-10-09  1:55   ` Simon Glass
2024-10-22 11:13   ` Stefan Roese
2024-10-03 21:28 ` [PATCH 11/13] ddr: altera: " Rasmus Villemoes
2024-10-09  1:52   ` Simon Glass
2024-10-22 11:13   ` Stefan Roese
2024-10-03 21:28 ` [PATCH 12/13] boot: cedit: " Rasmus Villemoes
2024-10-09  1:51   ` Simon Glass
2024-10-22 11:13   ` Stefan Roese
2024-10-03 21:28 ` [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h Rasmus Villemoes
2024-10-04 17:15   ` Tom Rini
2024-10-22 11:14   ` Stefan Roese
2024-10-04 11:20 ` [PATCH 00/13] disentangling cyclic API from schedule() Stefan Roese
2024-10-23 10:53 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox