summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <[email protected]>2025-11-14 10:32:42 +0100
committerHeinrich Schuchardt <[email protected]>2025-11-21 19:30:32 +0100
commit96db88e6216bf6d2d9ab82205fee6a5e6b05625e (patch)
tree035353d4debb1e8b00a71a47cf7486c4adcceefb /lib
parente58a54571e1d7d572a05b66f7dd1aafbfa7fea51 (diff)
efi_selftest: simplify efi_selftest_rtc
Use global st_runtime. Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_selftest/efi_selftest_rtc.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/lib/efi_selftest/efi_selftest_rtc.c b/lib/efi_selftest/efi_selftest_rtc.c
index e9e47e96c4b..54d4e786a8f 100644
--- a/lib/efi_selftest/efi_selftest_rtc.c
+++ b/lib/efi_selftest/efi_selftest_rtc.c
@@ -12,22 +12,6 @@
#define EFI_ST_NO_RTC "Could not read real time clock\n"
#define EFI_ST_NO_RTC_SET "Could not set real time clock\n"
-static struct efi_runtime_services *runtime;
-
-/*
- * Setup unit test.
- *
- * @handle: handle of the loaded image
- * @systable: system table
- * Return: EFI_ST_SUCCESS for success
- */
-static int setup(const efi_handle_t handle,
- const struct efi_system_table *systable)
-{
- runtime = systable->runtime;
- return EFI_ST_SUCCESS;
-}
-
/*
* Execute unit test.
*
@@ -53,7 +37,7 @@ static int execute(void)
#endif
/* Display current time */
- ret = runtime->get_time(&tm_old, NULL);
+ ret = st_runtime->get_time(&tm_old, NULL);
if (ret != EFI_SUCCESS) {
efi_st_error(EFI_ST_NO_RTC);
return EFI_ST_FAILURE;
@@ -63,12 +47,12 @@ static int execute(void)
tm_old.year, tm_old.month, tm_old.day,
tm_old.hour, tm_old.minute, tm_old.second);
#ifdef CONFIG_EFI_SET_TIME
- ret = runtime->set_time(&tm_new);
+ ret = st_runtime->set_time(&tm_new);
if (ret != EFI_SUCCESS) {
efi_st_error(EFI_ST_NO_RTC_SET);
return EFI_ST_FAILURE;
}
- ret = runtime->get_time(&tm, NULL);
+ ret = st_runtime->get_time(&tm, NULL);
if (ret != EFI_SUCCESS) {
efi_st_error(EFI_ST_NO_RTC);
return EFI_ST_FAILURE;
@@ -84,7 +68,7 @@ static int execute(void)
return EFI_ST_FAILURE;
}
/* Set time back to old value */
- ret = runtime->set_time(&tm_old);
+ ret = st_runtime->set_time(&tm_old);
if (ret != EFI_SUCCESS) {
efi_st_error(EFI_ST_NO_RTC_SET);
return EFI_ST_FAILURE;
@@ -97,6 +81,5 @@ static int execute(void)
EFI_UNIT_TEST(rtc) = {
.name = "real time clock",
.phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
- .setup = setup,
.execute = execute,
};