mbox series

[00/13] disentangling cyclic API from schedule()

Message ID 20241003212802.3810-1-ravi@prevas.dk
Headers show
Series disentangling cyclic API from schedule() | expand

Message

Rasmus Villemoes Oct. 3, 2024, 9:27 p.m. UTC
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

Comments

Stefan Roese Oct. 4, 2024, 11:20 a.m. UTC | #1
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