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

Simon Glass sjg at chromium.org
Tue Aug 30 04:31:35 CEST 2022


Hi Stefan,

On Mon, 29 Aug 2022 at 00:23, Stefan Roese <sr at denx.de> wrote:
>
> This patch introduces a schedule() function, which shall be used instead
> of the old WATCHDOG_RESET. Follow-up patches will make sure, that this
> new function is used.
>
> Signed-off-by: Stefan Roese <sr at denx.de>
> ---
>  common/cyclic.c  | 11 +++++++++++
>  include/cyclic.h |  5 +++++
>  2 files changed, 16 insertions(+)

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

but see below

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

Both of these need a full function comment.

>  #else
>  static inline struct cyclic_info *cyclic_register(cyclic_func_t func,
>                                                   uint64_t delay_us,
> @@ -96,6 +97,10 @@ static inline void cyclic_run(void)
>  {
>  }
>
> +static inline void schedule(void)
> +{
> +}
> +
>  static inline int cyclic_init(void)
>  {
>         return 0;
> --
> 2.37.2
>

Regards,
Simon


More information about the U-Boot mailing list