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

Simon Glass sjg at chromium.org
Wed Oct 9 03:52:38 CEST 2024


On Thu, 3 Oct 2024 at 15:28, Rasmus Villemoes <ravi at 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 at 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 at chromium.org>

But could it just be include/schedule.h ?


More information about the U-Boot mailing list