Skip to contentSkip to conversation

disentangling cyclic API from schedule()

PATCH In review Rasmus Villemoes 4 participants 44 messages Oct 3, 2024 – Oct 23, 2024

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover disentangling cyclic API from schedule()

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
Signature · 1 line
2.46.2
#1 lore raw

PATCH 1/13 doc: cyclic: remove reference to WATCHDOG_RESET

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.

---
 doc/develop/cyclic.rst | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
doc/develop/cyclic.rst +5 -5
index 893c269099a..6f1da6f0d9b 100644
@@ -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.
Signature · 1 line
2.46.2
Reviewed-by on v1 1/13
#2 lore raw

Re: [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET

Quoted 8 lines · 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.

Quoted 5 lines
---
 doc/develop/cyclic.rst | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 21 lines
doc/develop/cyclic.rst +5 -6
index 893c269099a..6f1da6f0d9b 100644
@@ -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

Reviewed-by on v1 1/13
#3 lore raw

Re: [PATCH 01/13] doc: cyclic: remove reference to WATCHDOG_RESET

In reply to Rasmus Villemoes
Quoted 8 lines · 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.

Thanks,
Stefan

Quoted 12 lines
---
  doc/develop/cyclic.rst | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
doc/develop/cyclic.rst +0 -0
index 893c269099a..6f1da6f0d9b 100644
@@ -49,8 +49,8 @@ executed all 10ms.
  How is this cyclic functionality integrated /  executed?
  --------------------------------------------------------
 

doc/develop/cyclic.rst executed all 10ms. · line 56

Quoted 10 lines
doc/develop/cyclic.rst +5 -5
-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

Signature · 3 lines
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: [email protected]
#4 lore raw

PATCH 2/13 cyclic: introduce u-boot/schedule.h

In reply to 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>.

---
 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
common/cyclic.c +1 -0
index ec38fad6775..38d815bec35 100644
@@ -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;
 
include/cyclic.h +1 -11
index cd95b691d48..e8de616dcd5 100644
@@ -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;
include/u-boot/schedule.h new file +24 -0
new file mode 100644
index 00000000000..4fd34c41229
@@ -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
Signature · 1 line
2.46.2
Reviewed-by on v1 2/13
#5 lore raw

Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h

Quoted 29 lines · 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>.

Quoted 7 lines
---
 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

But could it just be include/schedule.h ?

#6 lore raw

Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h

Quoted 11 lines · Simon Glass
Quoted 5 lines · Rasmus Villemoes
 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

But could it just be include/schedule.h ?

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

Quoted 5 lines
Quoted 5 lines

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

#7 lore raw

Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h

Hi Rasmus,

Quoted 23 lines · Rasmus Villemoes
Quoted 11 lines · Simon Glass
Quoted 5 lines · Rasmus Villemoes
 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

But could it just be include/schedule.h ?

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

Quoted 5 lines
Quoted 5 lines

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>.

Quoted 4 lines

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

Reviewed-by on v1 2/13
#8 lore raw

Re: [PATCH 02/13] cyclic: introduce u-boot/schedule.h

In reply to Rasmus Villemoes
Quoted 22 lines · 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.

Quoted 7 lines

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>.

Thanks,
Stefan

Quoted 76 lines
---
  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

common/cyclic.c +1 -0
index ec38fad6775..38d815bec35 100644
@@ -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;
 
include/cyclic.h +1 -11
index cd95b691d48..e8de616dcd5 100644
@@ -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;
include/u-boot/schedule.h new file +14 -0
new file mode 100644
index 00000000000..4fd34c41229
@@ -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);

include/u-boot/schedule.h line 24

Quoted 10 lines
include/u-boot/schedule.h new file +10 -0
+
+#else
+
+static inline void schedule(void)
+{
+}
+
+#endif
+
+#endif

Viele Grüße,
Stefan Roese

Signature · 3 lines
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: [email protected]
#9 lore raw

PATCH 3/13 led: include cyclic.h in led_sw_blink.c

In reply to 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.

---
 drivers/led/led_sw_blink.c | 1 +
 1 file changed, 1 insertion(+)
drivers/led/led_sw_blink.c +1 -0
index 9e36edbee47..6976b84544e 100644
@@ -5,6 +5,7 @@
  * Author: Mikhail Kshevetskiy <[email protected]>
  */
 
+#include <cyclic.h>
 #include <dm.h>
 #include <led.h>
 #include <time.h>
Signature · 1 line
2.46.2
Reviewed-by on v1 3/13
#10 lore raw

Re: [PATCH 03/13] led: include cyclic.h in led_sw_blink.c

Quoted 10 lines · 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.

---
 drivers/led/led_sw_blink.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
drivers/led/led_sw_blink.c +1 -1
index 9e36edbee47..6976b84544e 100644
@@ -5,6 +5,7 @@
  * Author: Mikhail Kshevetskiy <[email protected]>
  */
 
+#include <cyclic.h>
 #include <dm.h>
 #include <led.h>
 #include <time.h>
--

2.46.2

Reviewed-by on v1 3/13
#11 lore raw

Re: [PATCH 03/13] led: include cyclic.h in led_sw_blink.c

In reply to Rasmus Villemoes
Quoted 5 lines · 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.

Thanks,
Stefan

Quoted 9 lines
---
  drivers/led/led_sw_blink.c | 1 +
  1 file changed, 1 insertion(+)
drivers/led/led_sw_blink.c +0 -0
index 9e36edbee47..6976b84544e 100644

drivers/led/led_sw_blink.c line 11

Quoted 7 lines
drivers/led/led_sw_blink.c +1 -0
@@ -5,6 +5,7 @@
   * Author: Mikhail Kshevetskiy <[email protected]>
   */
 
+#include <cyclic.h>
  #include <dm.h>
  #include <led.h>
  #include <time.h>

Viele Grüße,
Stefan Roese

Signature · 3 lines
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: [email protected]
#12 lore raw

PATCH 4/13 m68k: asm/ptrace.h: include linux/types.h

In reply to 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.

---
 arch/m68k/include/asm/ptrace.h | 2 ++
 1 file changed, 2 insertions(+)
arch/m68k/include/asm/ptrace.h +2 -0
index d419824806c..5decf73a1d1 100644
@@ -9,6 +9,8 @@
  */
 #ifndef __ASSEMBLY__
 
+#include <linux/types.h>
+
 struct pt_regs {
 	ulong d0;
 	ulong d1;
Signature · 1 line
2.46.2
Reviewed-by on v1 4/13
#13 lore raw

Re: [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h

Quoted 9 lines · 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.

Signature · 1 line
Tom
Reviewed-by on v1 4/13
#14 lore raw

Re: [PATCH 04/13] m68k: asm/ptrace.h: include linux/types.h

In reply to Rasmus Villemoes
Quoted 9 lines · 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.

Thanks,
Stefan

Quoted 9 lines
---
  arch/m68k/include/asm/ptrace.h | 2 ++
  1 file changed, 2 insertions(+)
arch/m68k/include/asm/ptrace.h +0 -0
index d419824806c..5decf73a1d1 100644

arch/m68k/include/asm/ptrace.h line 16

Quoted 8 lines
arch/m68k/include/asm/ptrace.h +2 -0
@@ -9,6 +9,8 @@
   */
  #ifndef __ASSEMBLY__
 
+#include <linux/types.h>
+
  struct pt_regs {
  	ulong d0;
  	ulong d1;

Viele Grüße,
Stefan Roese

Signature · 3 lines
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: [email protected]
#15 lore raw

PATCH 5/13 fs/cramfs: use schedule instead of cyclic_run as callback

In reply to 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.

---
 fs/cramfs/uncompress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cramfs/uncompress.c +2 -2
index 2141edf22e4..97af8cb2b4f 100644
@@ -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 */
Signature · 1 line
2.46.2
Reviewed-by on v1 5/13
#16 lore raw

Re: [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback

Quoted 16 lines · 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.

Quoted 4 lines
---
 fs/cramfs/uncompress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 28 lines
fs/cramfs/uncompress.c +2 -3
index 2141edf22e4..97af8cb2b4f 100644
@@ -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

Reviewed-by on v1 5/13
#17 lore raw

Re: [PATCH 05/13] fs/cramfs: use schedule instead of cyclic_run as callback

In reply to Rasmus Villemoes
Quoted 9 lines · 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();
}
Quoted 7 lines

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.

Thanks,
Stefan

Quoted 20 lines
---
  fs/cramfs/uncompress.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/cramfs/uncompress.c +1 -1
index 2141edf22e4..97af8cb2b4f 100644
@@ -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;

fs/cramfs/uncompress.c int cramfs_uncompress_init (void) · line 69

Quoted 8 lines
fs/cramfs/uncompress.c +1 -1
@@ -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

Signature · 3 lines
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: [email protected]
#18 lore raw

PATCH 6/13 test: dm: wdt: replace cyclic_run() by schedule()

In reply to 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.

---
 test/dm/wdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
test/dm/wdt.c +5 -5
index 1df2da23c6c..4d751b7e8cf 100644
@@ -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));
 
Signature · 1 line
2.46.2
Reviewed-by on v1 6/13
#19 lore raw

Re: [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule()

Quoted 11 lines · 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.

---
 test/dm/wdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Reviewed-by on v1 6/13
#20 lore raw

Re: [PATCH 06/13] test: dm: wdt: replace cyclic_run() by schedule()

In reply to Rasmus Villemoes
Quoted 7 lines · 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.

Thanks,
Stefan

Quoted 46 lines
---
  test/dm/wdt.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
test/dm/wdt.c +4 -4
index 1df2da23c6c..4d751b7e8cf 100644
@@ -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();

test/dm/wdt.c static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts) · line 159

Quoted 10 lines
test/dm/wdt.c +1 -1
  	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

Signature · 3 lines
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: [email protected]
#21 lore raw

PATCH 7/13 cyclic: make cyclic_run static

In reply to Rasmus Villemoes

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

---
 common/cyclic.c  |  2 +-
 include/cyclic.h | 12 ------------
 2 files changed, 1 insertion(+), 13 deletions(-)
common/cyclic.c +1 -1
index 38d815bec35..196797fd61e 100644
@@ -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;
include/cyclic.h +0 -12
index e8de616dcd5..c6c463d68e9 100644
@@ -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;
Signature · 1 line
2.46.2
Reviewed-by on v1 7/13
#22 lore raw

Re: [PATCH 07/13] cyclic: make cyclic_run static

Quoted 9 lines · Rasmus Villemoes

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

---
 common/cyclic.c  |  2 +-
 include/cyclic.h | 12 ------------
 2 files changed, 1 insertion(+), 13 deletions(-)
Reviewed-by on v1 7/13
#23 lore raw

Re: [PATCH 07/13] cyclic: make cyclic_run static

In reply to Rasmus Villemoes
Quoted 4 lines · Rasmus Villemoes

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

Thanks,
Stefan

Quoted 38 lines
---
  common/cyclic.c  |  2 +-
  include/cyclic.h | 12 ------------
  2 files changed, 1 insertion(+), 13 deletions(-)
common/cyclic.c +1 -1
index 38d815bec35..196797fd61e 100644
@@ -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;
include/cyclic.h +0 -8
index e8de616dcd5..c6c463d68e9 100644
@@ -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,

include/cyclic.h static inline void cyclic_unregister(struct cyclic_info *cyclic) · line 103

Quoted 10 lines
include/cyclic.h +0 -4
@@ -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

Signature · 3 lines
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: [email protected]
#24 lore raw

PATCH 8/13 watchdog.h: change include of cyclic.h to u-boot/schedule.h

In reply to 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.

---
 include/watchdog.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/watchdog.h +1 -1
index d1956fafca1..0149b44d077 100644
@@ -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
Signature · 1 line
2.46.2
Reviewed-by on v1 8/13
#25 lore raw

Re: [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h

Quoted 7 lines · 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.

Quoted 8 lines

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.

---
 include/watchdog.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by on v1 8/13
#26 lore raw

Re: [PATCH 08/13] watchdog.h: change include of cyclic.h to u-boot/schedule.h

In reply to Rasmus Villemoes
Quoted 11 lines · 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.

Thanks,
Stefan

Quoted 9 lines
---
  include/watchdog.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/watchdog.h +0 -0
index d1956fafca1..0149b44d077 100644

include/watchdog.h line 16

Quoted 8 lines
include/watchdog.h +1 -1
@@ -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

Signature · 3 lines
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: [email protected]
#27 lore raw

PATCH 9/13 lib/sha*: include u-boot/schedule.h instead of cyclic.h

In reply to 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.

---
 lib/sha1.c   | 2 +-
 lib/sha256.c | 2 +-
 lib/sha512.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
lib/sha1.c +1 -1
index 7ef536f4b5d..233bd9145c6 100644
@@ -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>
lib/sha256.c +1 -1
index 665ba6f152e..329802fd827 100644
@@ -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>
lib/sha512.c +1 -1
index ffe2c5cd964..ea555ff33eb 100644
@@ -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>
Signature · 1 line
2.46.2
Reviewed-by on v1 9/13
#28 lore raw

Re: [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h

Quoted 8 lines · 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.

Quoted 6 lines
---
 lib/sha1.c   | 2 +-
 lib/sha256.c | 2 +-
 lib/sha512.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Reviewed-by on v1 9/13
#29 lore raw

Re: [PATCH 09/13] lib/sha*: include u-boot/schedule.h instead of cyclic.h

In reply to Rasmus Villemoes
Quoted 8 lines · 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.

Thanks,
Stefan

Quoted 37 lines
---
  lib/sha1.c   | 2 +-
  lib/sha256.c | 2 +-
  lib/sha512.c | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
lib/sha1.c +1 -1
index 7ef536f4b5d..233bd9145c6 100644
@@ -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>
lib/sha256.c +1 -1
index 665ba6f152e..329802fd827 100644
@@ -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>
lib/sha512.c +0 -0
index ffe2c5cd964..ea555ff33eb 100644

lib/sha512.c line 17

Quoted 8 lines
lib/sha512.c +1 -1
@@ -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

Signature · 3 lines
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: [email protected]
#30 lore raw

PATCH 10/13 i2c: rzg2l: include u-boot/schedule.h

In reply to Rasmus Villemoes

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

---
 drivers/i2c/rz_riic.c | 1 +
 1 file changed, 1 insertion(+)
drivers/i2c/rz_riic.c +1 -0
index 5f3f8d1b24b..f292c824362 100644
@@ -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
Signature · 1 line
2.46.2
Reviewed-by on v1 10/13
#31 lore raw

Re: [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h

Quoted 9 lines · Rasmus Villemoes

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

---
 drivers/i2c/rz_riic.c | 1 +
 1 file changed, 1 insertion(+)

drivers/i2c/rz_riic.c line 18

Quoted 10 lines
drivers/i2c/rz_riic.c +1 -0
index 5f3f8d1b24b..f292c824362 100644
@@ -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.

Quoted 5 lines
drivers/i2c/rz_riic.c +0 -1
 #define RIIC_ICCR1     0x00
--

2.46.2

Reviewed-by on v1 10/13
#32 lore raw

Re: [PATCH 10/13] i2c: rzg2l: include u-boot/schedule.h

In reply to Rasmus Villemoes
Quoted 4 lines · Rasmus Villemoes

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

Thanks,
Stefan

Quoted 9 lines
---
  drivers/i2c/rz_riic.c | 1 +
  1 file changed, 1 insertion(+)
drivers/i2c/rz_riic.c +0 -0
index 5f3f8d1b24b..f292c824362 100644

drivers/i2c/rz_riic.c line 20

Quoted 7 lines
drivers/i2c/rz_riic.c +1 -0
@@ -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

Signature · 3 lines
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: [email protected]
#33 lore raw

PATCH 11/13 ddr: altera: include u-boot/schedule.h

In reply to Rasmus Villemoes

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

---
 drivers/ddr/altera/sdram_n5x.c   | 1 +
 drivers/ddr/altera/sdram_soc64.c | 1 +
 2 files changed, 2 insertions(+)
drivers/ddr/altera/sdram_n5x.c +1 -0
index db09986f64b..d1fc93b6bdd 100644
@@ -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;
 
drivers/ddr/altera/sdram_soc64.c +1 -0
index 9e57c2ecfa4..10a8e64af3d 100644
@@ -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
 
Signature · 1 line
2.46.2
Reviewed-by on v1 11/13
#34 lore raw

Re: [PATCH 11/13] ddr: altera: include u-boot/schedule.h

Quoted 9 lines · Rasmus Villemoes

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

---
 drivers/ddr/altera/sdram_n5x.c   | 1 +
 drivers/ddr/altera/sdram_soc64.c | 1 +
 2 files changed, 2 insertions(+)
Quoted 28 lines
drivers/ddr/altera/sdram_n5x.c +1 -0
index db09986f64b..d1fc93b6bdd 100644
@@ -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;
 
drivers/ddr/altera/sdram_soc64.c +1 -1
index 9e57c2ecfa4..10a8e64af3d 100644
@@ -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

Reviewed-by on v1 11/13
#35 lore raw

Re: [PATCH 11/13] ddr: altera: include u-boot/schedule.h

In reply to Rasmus Villemoes
Quoted 4 lines · Rasmus Villemoes

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

Thanks,
Stefan

Quoted 22 lines
---
  drivers/ddr/altera/sdram_n5x.c   | 1 +
  drivers/ddr/altera/sdram_soc64.c | 1 +
  2 files changed, 2 insertions(+)
drivers/ddr/altera/sdram_n5x.c +1 -0
index db09986f64b..d1fc93b6bdd 100644
@@ -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;
 
drivers/ddr/altera/sdram_soc64.c +0 -0
index 9e57c2ecfa4..10a8e64af3d 100644

drivers/ddr/altera/sdram_soc64.c line 30

Quoted 7 lines
drivers/ddr/altera/sdram_soc64.c +1 -0
@@ -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

Signature · 3 lines
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: [email protected]
#36 lore raw

PATCH 12/13 boot: cedit: include u-boot/schedule.h

In reply to Rasmus Villemoes

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

---
 boot/cedit.c | 1 +
 1 file changed, 1 insertion(+)
boot/cedit.c +1 -0
index c29a2be14ce..ff0efda3a7b 100644
@@ -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,
Signature · 1 line
2.46.2
Reviewed-by on v1 12/13
#37 lore raw

Re: [PATCH 12/13] boot: cedit: include u-boot/schedule.h

Quoted 9 lines · Rasmus Villemoes

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

---
 boot/cedit.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
boot/cedit.c +1 -1
index c29a2be14ce..ff0efda3a7b 100644
@@ -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

Reviewed-by on v1 12/13
#38 lore raw

Re: [PATCH 12/13] boot: cedit: include u-boot/schedule.h

In reply to Rasmus Villemoes
Quoted 4 lines · Rasmus Villemoes

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

Thanks,
Stefan

Quoted 9 lines
---
  boot/cedit.c | 1 +
  1 file changed, 1 insertion(+)
boot/cedit.c +0 -0
index c29a2be14ce..ff0efda3a7b 100644

boot/cedit.c line 26

Quoted 7 lines
boot/cedit.c +1 -0
@@ -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

Signature · 3 lines
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: [email protected]
#39 lore raw

PATCH 13/13 global_data.h: remove unnecesary include of cyclic.h

In reply to 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.

---
 include/asm-generic/global_data.h | 1 -
 1 file changed, 1 deletion(-)
include/asm-generic/global_data.h +0 -1
index 27aa75e7036..1570ad8f0c0 100644
@@ -20,7 +20,6 @@
  */
 
 #ifndef __ASSEMBLY__
-#include <cyclic.h>
 #include <event_internal.h>
 #include <fdtdec.h>
 #include <membuff.h>
Signature · 1 line
2.46.2
Reviewed-by on v1 13/13
#40 lore raw

Re: [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h

Quoted 7 lines · 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.

Signature · 1 line
Tom
Reviewed-by on v1 13/13
#41 lore raw

Re: [PATCH 13/13] global_data.h: remove unnecesary include of cyclic.h

In reply to Rasmus Villemoes
Quoted 7 lines · 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.

Thanks,
Stefan

Quoted 9 lines
---
  include/asm-generic/global_data.h | 1 -
  1 file changed, 1 deletion(-)
include/asm-generic/global_data.h +0 -0
index 27aa75e7036..1570ad8f0c0 100644

include/asm-generic/global_data.h line 25

Quoted 7 lines
include/asm-generic/global_data.h +0 -1
@@ -20,7 +20,6 @@
   */
 
  #ifndef __ASSEMBLY__
-#include <cyclic.h>
  #include <event_internal.h>
  #include <fdtdec.h>
  #include <membuff.h>

Viele Grüße,
Stefan Roese

Signature · 3 lines
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: [email protected]
#42 lore raw
In reply to Rasmus Villemoes

Hi Rasmus,

Quoted 57 lines · 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(-)
Quoted 1 line

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

#43 lore raw
In reply to Rasmus Villemoes
Quoted 57 lines · 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(-)
Quoted 2 lines

create mode 100644 include/u-boot/schedule.h

Applied to u-boot-watchdog/master

Thanks,
Stefan