diff mbox series

[v9,08/15] event: Add an event for main_loop

Message ID 20220826095716.1676150-9-sughosh.ganu@linaro.org
State Superseded
Headers show
Series FWU: Add FWU Multi Bank Update feature support | expand

Commit Message

Sughosh Ganu Aug. 26, 2022, 9:57 a.m. UTC
Add an event type EVT_MAIN_LOOP that can be used for registering
events that need to be run after the platform has been initialised and
before the main_loop function is called.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
Changes since V8: New patch

 common/board_r.c | 3 +++
 common/event.c   | 3 +++
 include/event.h  | 3 +++
 3 files changed, 9 insertions(+)

Comments

Simon Glass Aug. 27, 2022, 12:20 a.m. UTC | #1
On Fri, 26 Aug 2022 at 03:58, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> Add an event type EVT_MAIN_LOOP that can be used for registering
> events that need to be run after the platform has been initialised and
> before the main_loop function is called.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V8: New patch
>
>  common/board_r.c | 3 +++
>  common/event.c   | 3 +++
>  include/event.h  | 3 +++
>  3 files changed, 9 insertions(+)

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

But please add more detail below.

>
> diff --git a/common/board_r.c b/common/board_r.c
> index 56eb60fa27..1db061e65c 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -576,6 +576,9 @@ static int run_main_loop(void)
>  #ifdef CONFIG_SANDBOX
>         sandbox_main_loop_init();
>  #endif
> +
> +       event_notify_null(EVT_MAIN_LOOP);
> +
>         /* main_loop() can return to retry autoboot, if so just run it again */
>         for (;;)
>                 main_loop();
> diff --git a/common/event.c b/common/event.c
> index 3e34550978..231b9e6ffd 100644
> --- a/common/event.c
> +++ b/common/event.c
> @@ -38,6 +38,9 @@ const char *const type_name[] = {
>
>         /* fdt hooks */
>         "ft_fixup",
> +
> +       /* main loop events */
> +       "main_loop",
>  };
>
>  _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
> diff --git a/include/event.h b/include/event.h
> index e8f2f55c63..0748d676df 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -34,6 +34,9 @@ enum event_t {
>         /* Device tree fixups before booting */
>         EVT_FT_FIXUP,
>
> +       /* To be called from main_loop */

This is vague. Please indicate exactly when it is called, i.e. only
once, just before the main loop is run for the first time.

> +       EVT_MAIN_LOOP,
> +
>         EVT_COUNT
>  };
>
> --
> 2.34.1
>

Regards,
SImon
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 56eb60fa27..1db061e65c 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -576,6 +576,9 @@  static int run_main_loop(void)
 #ifdef CONFIG_SANDBOX
 	sandbox_main_loop_init();
 #endif
+
+	event_notify_null(EVT_MAIN_LOOP);
+
 	/* main_loop() can return to retry autoboot, if so just run it again */
 	for (;;)
 		main_loop();
diff --git a/common/event.c b/common/event.c
index 3e34550978..231b9e6ffd 100644
--- a/common/event.c
+++ b/common/event.c
@@ -38,6 +38,9 @@  const char *const type_name[] = {
 
 	/* fdt hooks */
 	"ft_fixup",
+
+	/* main loop events */
+	"main_loop",
 };
 
 _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
diff --git a/include/event.h b/include/event.h
index e8f2f55c63..0748d676df 100644
--- a/include/event.h
+++ b/include/event.h
@@ -34,6 +34,9 @@  enum event_t {
 	/* Device tree fixups before booting */
 	EVT_FT_FIXUP,
 
+	/* To be called from main_loop */
+	EVT_MAIN_LOOP,
+
 	EVT_COUNT
 };