From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH 2/3] efi_selftest: rename event_notify
Date: Thu, 6 Oct 2022 09:38:01 +0300 [thread overview]
Message-ID: <Yz53ySShNL+KonD+@hera> (raw)
In-Reply-To: <20221006054933.47004-3-heinrich.schuchardt@canonical.com>
On Thu, Oct 06, 2022 at 07:49:32AM +0200, Heinrich Schuchardt wrote:
> A function event_notify() exists. We should not use the same name for and
> EFI event. Rename events in unit tests.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> lib/efi_selftest/efi_selftest_events.c | 18 +++----
> .../efi_selftest_exitbootservices.c | 6 +--
> lib/efi_selftest/efi_selftest_tpl.c | 47 ++++++++++---------
> lib/efi_selftest/efi_selftest_watchdog.c | 30 ++++++------
> 4 files changed, 55 insertions(+), 46 deletions(-)
>
> diff --git a/lib/efi_selftest/efi_selftest_events.c b/lib/efi_selftest/efi_selftest_events.c
> index 90071536a2..743a6b9154 100644
> --- a/lib/efi_selftest/efi_selftest_events.c
> +++ b/lib/efi_selftest/efi_selftest_events.c
> @@ -11,7 +11,7 @@
>
> #include <efi_selftest.h>
>
> -static struct efi_event *event_notify;
> +static struct efi_event *efi_st_event_notify;
> static struct efi_event *event_wait;
> static unsigned int timer_ticks;
> static struct efi_boot_services *boottime;
> @@ -50,7 +50,7 @@ static int setup(const efi_handle_t handle,
>
> ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL,
> TPL_CALLBACK, notify, (void *)&timer_ticks,
> - &event_notify);
> + &efi_st_event_notify);
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not create event\n");
> return EFI_ST_FAILURE;
> @@ -75,9 +75,9 @@ static int teardown(void)
> {
> efi_status_t ret;
>
> - if (event_notify) {
> - ret = boottime->close_event(event_notify);
> - event_notify = NULL;
> + if (efi_st_event_notify) {
> + ret = boottime->close_event(efi_st_event_notify);
> + efi_st_event_notify = NULL;
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not close event\n");
> return EFI_ST_FAILURE;
> @@ -112,7 +112,8 @@ static int execute(void)
>
> /* Set 10 ms timer */
> timer_ticks = 0;
> - ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 100000);
> + ret = boottime->set_timer(efi_st_event_notify, EFI_TIMER_PERIODIC,
> + 100000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> @@ -146,14 +147,15 @@ static int execute(void)
> efi_st_error("Incorrect timing of events\n");
> return EFI_ST_FAILURE;
> }
> - ret = boottime->set_timer(event_notify, EFI_TIMER_STOP, 0);
> + ret = boottime->set_timer(efi_st_event_notify, EFI_TIMER_STOP, 0);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not cancel timer\n");
> return EFI_ST_FAILURE;
> }
> /* Set 10 ms timer */
> timer_ticks = 0;
> - ret = boottime->set_timer(event_notify, EFI_TIMER_RELATIVE, 100000);
> + ret = boottime->set_timer(efi_st_event_notify, EFI_TIMER_RELATIVE,
> + 100000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> diff --git a/lib/efi_selftest/efi_selftest_exitbootservices.c b/lib/efi_selftest/efi_selftest_exitbootservices.c
> index f5e0d9da89..11b43fdd90 100644
> --- a/lib/efi_selftest/efi_selftest_exitbootservices.c
> +++ b/lib/efi_selftest/efi_selftest_exitbootservices.c
> @@ -26,7 +26,7 @@ struct notification_context {
> };
>
> static struct efi_boot_services *boottime;
> -static struct efi_event *event_notify;
> +static struct efi_event *efi_st_event_notify;
> struct notification_record record;
>
> struct notification_context context_before = {
> @@ -75,7 +75,7 @@ static int setup(const efi_handle_t handle,
> ret = boottime->create_event(EVT_SIGNAL_EXIT_BOOT_SERVICES,
> TPL_CALLBACK, ebs_notify,
> &context,
> - &event_notify);
> + &efi_st_event_notify);
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not create event\n");
> return EFI_ST_FAILURE;
> @@ -83,7 +83,7 @@ static int setup(const efi_handle_t handle,
> ret = boottime->create_event_ex(0, TPL_CALLBACK, ebs_notify,
> &context_before,
> &guid_before_exit_boot_services,
> - &event_notify);
> + &efi_st_event_notify);
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not create event\n");
> return EFI_ST_FAILURE;
> diff --git a/lib/efi_selftest/efi_selftest_tpl.c b/lib/efi_selftest/efi_selftest_tpl.c
> index f4e467267e..909c78a1c2 100644
> --- a/lib/efi_selftest/efi_selftest_tpl.c
> +++ b/lib/efi_selftest/efi_selftest_tpl.c
> @@ -10,8 +10,8 @@
>
> #include <efi_selftest.h>
>
> -static struct efi_event *event_notify;
> -static struct efi_event *event_wait;
> +static struct efi_event *efi_st_event_notify;
> +static struct efi_event *efi_st_event_wait;
> static unsigned int notification_count;
> static struct efi_boot_services *boottime;
>
> @@ -49,13 +49,14 @@ static int setup(const efi_handle_t handle,
> ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL,
> TPL_CALLBACK, notify,
> (void *)¬ification_count,
> - &event_notify);
> + &efi_st_event_notify);
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not create event\n");
> return EFI_ST_FAILURE;
> }
> ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT,
> - TPL_NOTIFY, notify, NULL, &event_wait);
> + TPL_NOTIFY, notify, NULL,
> + &efi_st_event_wait);
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not create event\n");
> return EFI_ST_FAILURE;
> @@ -74,17 +75,17 @@ static int teardown(void)
> {
> efi_status_t ret;
>
> - if (event_notify) {
> - ret = boottime->close_event(event_notify);
> - event_notify = NULL;
> + if (efi_st_event_notify) {
> + ret = boottime->close_event(efi_st_event_notify);
> + efi_st_event_notify = NULL;
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not close event\n");
> return EFI_ST_FAILURE;
> }
> }
> - if (event_wait) {
> - ret = boottime->close_event(event_wait);
> - event_wait = NULL;
> + if (efi_st_event_wait) {
> + ret = boottime->close_event(efi_st_event_wait);
> + efi_st_event_wait = NULL;
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not close event\n");
> return EFI_ST_FAILURE;
> @@ -116,24 +117,26 @@ static int execute(void)
>
> /* Set 10 ms timer */
> notification_count = 0;
> - ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 100000);
> + ret = boottime->set_timer(efi_st_event_notify, EFI_TIMER_PERIODIC,
> + 100000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> }
> /* Set 100 ms timer */
> - ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1000000);
> + ret = boottime->set_timer(efi_st_event_wait, EFI_TIMER_RELATIVE,
> + 1000000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> }
> index = 5;
> - ret = boottime->wait_for_event(1, &event_wait, &index);
> + ret = boottime->wait_for_event(1, &efi_st_event_wait, &index);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not wait for event\n");
> return EFI_ST_FAILURE;
> }
> - ret = boottime->check_event(event_wait);
> + ret = boottime->check_event(efi_st_event_wait);
> if (ret != EFI_NOT_READY) {
> efi_st_error("Signaled state was not cleared.\n");
> efi_st_printf("ret = %u\n", (unsigned int)ret);
> @@ -150,7 +153,7 @@ static int execute(void)
> efi_st_error("Incorrect timing of events\n");
> return EFI_ST_FAILURE;
> }
> - ret = boottime->set_timer(event_notify, EFI_TIMER_STOP, 0);
> + ret = boottime->set_timer(efi_st_event_notify, EFI_TIMER_STOP, 0);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not cancel timer\n");
> return EFI_ST_FAILURE;
> @@ -163,19 +166,21 @@ static int execute(void)
> }
> /* Set 10 ms timer */
> notification_count = 0;
> - ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 100000);
> + ret = boottime->set_timer(efi_st_event_notify, EFI_TIMER_PERIODIC,
> + 100000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> }
> /* Set 100 ms timer */
> - ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1000000);
> + ret = boottime->set_timer(efi_st_event_wait, EFI_TIMER_RELATIVE,
> + 1000000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> }
> do {
> - ret = boottime->check_event(event_wait);
> + ret = boottime->check_event(efi_st_event_wait);
> } while (ret == EFI_NOT_READY);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not check event\n");
> @@ -189,14 +194,14 @@ static int execute(void)
> return EFI_ST_FAILURE;
> }
> /* Set 1 ms timer */
> - ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1000);
> + ret = boottime->set_timer(efi_st_event_wait, EFI_TIMER_RELATIVE, 1000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> }
> /* Restore the old TPL level */
> boottime->restore_tpl(TPL_APPLICATION);
> - ret = boottime->wait_for_event(1, &event_wait, &index);
> + ret = boottime->wait_for_event(1, &efi_st_event_wait, &index);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not wait for event\n");
> return EFI_ST_FAILURE;
> @@ -208,7 +213,7 @@ static int execute(void)
> efi_st_error("Queued timer event did not fire\n");
> return EFI_ST_FAILURE;
> }
> - ret = boottime->set_timer(event_wait, EFI_TIMER_STOP, 0);
> + ret = boottime->set_timer(efi_st_event_wait, EFI_TIMER_STOP, 0);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not cancel timer\n");
> return EFI_ST_FAILURE;
> diff --git a/lib/efi_selftest/efi_selftest_watchdog.c b/lib/efi_selftest/efi_selftest_watchdog.c
> index a352d4a5ad..4d7ed5a54b 100644
> --- a/lib/efi_selftest/efi_selftest_watchdog.c
> +++ b/lib/efi_selftest/efi_selftest_watchdog.c
> @@ -28,8 +28,8 @@ struct notify_context {
> unsigned int timer_ticks;
> };
>
> -static struct efi_event *event_notify;
> -static struct efi_event *event_wait;
> +static struct efi_event *efi_st_event_notify;
> +static struct efi_event *efi_st_event_wait;
> static struct efi_boot_services *boottime;
> static struct notify_context notification_context;
> static bool watchdog_reset;
> @@ -79,13 +79,14 @@ static int setup(const efi_handle_t handle,
> ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL,
> TPL_CALLBACK, notify,
> (void *)¬ification_context,
> - &event_notify);
> + &efi_st_event_notify);
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not create event\n");
> return EFI_ST_FAILURE;
> }
> ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT,
> - TPL_CALLBACK, notify, NULL, &event_wait);
> + TPL_CALLBACK, notify, NULL,
> + &efi_st_event_wait);
> if (ret != EFI_SUCCESS) {
> efi_st_error("could not create event\n");
> return EFI_ST_FAILURE;
> @@ -138,17 +139,17 @@ static int teardown(void)
> efi_st_error("Setting watchdog timer failed\n");
> return EFI_ST_FAILURE;
> }
> - if (event_notify) {
> - ret = boottime->close_event(event_notify);
> - event_notify = NULL;
> + if (efi_st_event_notify) {
> + ret = boottime->close_event(efi_st_event_notify);
> + efi_st_event_notify = NULL;
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not close event\n");
> return EFI_ST_FAILURE;
> }
> }
> - if (event_wait) {
> - ret = boottime->close_event(event_wait);
> - event_wait = NULL;
> + if (efi_st_event_wait) {
> + ret = boottime->close_event(efi_st_event_wait);
> + efi_st_event_wait = NULL;
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not close event\n");
> return EFI_ST_FAILURE;
> @@ -181,21 +182,22 @@ static int execute(void)
> }
> if (watchdog_reset) {
> /* Set 600 ms timer */
> - ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC,
> - 6000000);
> + ret = boottime->set_timer(efi_st_event_notify,
> + EFI_TIMER_PERIODIC, 6000000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> }
> }
> /* Set 1350 ms timer */
> - ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 13500000);
> + ret = boottime->set_timer(efi_st_event_wait, EFI_TIMER_RELATIVE,
> + 13500000);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not set timer\n");
> return EFI_ST_FAILURE;
> }
>
> - ret = boottime->wait_for_event(1, &event_wait, &index);
> + ret = boottime->wait_for_event(1, &efi_st_event_wait, &index);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Could not wait for event\n");
> return EFI_ST_FAILURE;
> --
> 2.37.2
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
next prev parent reply other threads:[~2022-10-06 6:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 5:49 [PATCH 0/3] efi_driver: move event registration to driver Heinrich Schuchardt
2022-10-06 5:49 ` [PATCH 1/3] efi_driver: add init function to EFI block driver Heinrich Schuchardt
2022-10-06 5:49 ` [PATCH 2/3] efi_selftest: rename event_notify Heinrich Schuchardt
2022-10-06 6:38 ` Ilias Apalodimas [this message]
2022-10-06 5:49 ` [PATCH 3/3] efi_driver: move event registration to driver Heinrich Schuchardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yz53ySShNL+KonD+@hera \
--to=ilias.apalodimas@linaro.org \
--cc=heinrich.schuchardt@canonical.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.