Message ID | 20210826175116.863036-1-alex.hung@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | acpi: replace fwts_firmware_detect() by fw->firmware_type | expand |
On 8/27/21 1:51 AM, Alex Hung wrote: > They are used interchangabley in fwts and let's stick with one for > readability and save some CPU cycles. > > There are no functional changes. > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/boot/boot.c | 2 +- > src/lib/src/fwts_efi_module.c | 2 +- > src/opal/power_mgmt_info.c | 2 +- > src/opal/reserv_mem.c | 2 +- > src/uefi/csm/csm.c | 2 +- > src/uefi/esrt/esrt.c | 2 +- > src/uefi/esrtdump/esrtdump.c | 2 +- > src/uefi/uefibootpath/uefibootpath.c | 2 +- > src/uefi/uefidump/uefidump.c | 2 +- > 9 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/src/acpi/boot/boot.c b/src/acpi/boot/boot.c > index cd41452f..ffbd2cd1 100644 > --- a/src/acpi/boot/boot.c > +++ b/src/acpi/boot/boot.c > @@ -35,7 +35,7 @@ static int boot_init(fwts_framework *fw) > fwts_log_error(fw, "Cannot read ACPI tables."); > return FWTS_ERROR; > } > - if (fwts_firmware_detect() == FWTS_FIRMWARE_UEFI) { > + if (fw->firmware_type == FWTS_FIRMWARE_UEFI) { > fwts_log_error(fw, "ACPI BOOT table is deprecated on UEFI firmware, skipping test"); > return FWTS_SKIP; > } > diff --git a/src/lib/src/fwts_efi_module.c b/src/lib/src/fwts_efi_module.c > index 3756d614..c1bc5ea1 100644 > --- a/src/lib/src/fwts_efi_module.c > +++ b/src/lib/src/fwts_efi_module.c > @@ -214,7 +214,7 @@ int fwts_lib_efi_runtime_kernel_lockdown(fwts_framework *fw) > int fwts_lib_efi_runtime_module_init(fwts_framework *fw, int *fd) > { > > - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { > + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { > fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); > return FWTS_ABORTED; > } > diff --git a/src/opal/power_mgmt_info.c b/src/opal/power_mgmt_info.c > index f53525d2..dc0c79f6 100644 > --- a/src/opal/power_mgmt_info.c > +++ b/src/opal/power_mgmt_info.c > @@ -84,7 +84,7 @@ static int power_mgmt_init(fwts_framework *fw) > { > int ret; > > - if (fwts_firmware_detect() != FWTS_FIRMWARE_OPAL) { > + if (fw->firmware_type != FWTS_FIRMWARE_OPAL) { > fwts_skipped(fw, > "The firmware type detected was non OPAL " > "so skipping the OPAL Power Management DT checks."); > diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c > index 2195f2aa..53274951 100644 > --- a/src/opal/reserv_mem.c > +++ b/src/opal/reserv_mem.c > @@ -105,7 +105,7 @@ static char *make_message(const char *fmt, ...) > > static int reserv_mem_init(fwts_framework *fw) > { > - if (fwts_firmware_detect() != FWTS_FIRMWARE_OPAL) { > + if (fw->firmware_type != FWTS_FIRMWARE_OPAL) { > fwts_skipped(fw, > "The firmware type detected was non OPAL " > "so skipping the OPAL Reserve Memory DT checks."); > diff --git a/src/uefi/csm/csm.c b/src/uefi/csm/csm.c > index 372b2919..b26e9c3c 100644 > --- a/src/uefi/csm/csm.c > +++ b/src/uefi/csm/csm.c > @@ -45,7 +45,7 @@ static int csm_test1(fwts_framework *fw) > > fwts_log_info(fw, "Checking for UEFI Compatibility Support Module (CSM)"); > > - if (fwts_firmware_detect() == FWTS_FIRMWARE_UEFI) > + if (fw->firmware_type == FWTS_FIRMWARE_UEFI) > flag |= EFI_SUPPORT; > > /* Get Int 10h vector from segment/offset realmode address */ > diff --git a/src/uefi/esrt/esrt.c b/src/uefi/esrt/esrt.c > index 7193ef8c..8d613bcb 100644 > --- a/src/uefi/esrt/esrt.c > +++ b/src/uefi/esrt/esrt.c > @@ -40,7 +40,7 @@ > static int esrt_init(fwts_framework *fw) > { > > - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { > + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { > fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); > return FWTS_ABORTED; > } > diff --git a/src/uefi/esrtdump/esrtdump.c b/src/uefi/esrtdump/esrtdump.c > index 68e5993b..ff4e40eb 100644 > --- a/src/uefi/esrtdump/esrtdump.c > +++ b/src/uefi/esrtdump/esrtdump.c > @@ -32,7 +32,7 @@ > > static int esrtdump_init(fwts_framework *fw) > { > - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { > + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { > fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); > return FWTS_ABORTED; > } > diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c > index 417d36c3..cb942020 100644 > --- a/src/uefi/uefibootpath/uefibootpath.c > +++ b/src/uefi/uefibootpath/uefibootpath.c > @@ -35,7 +35,7 @@ static inline bool uefibootpath_check_pnpid(uint32_t id) > > static int uefibootpath_init(fwts_framework *fw) > { > - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { > + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { > fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); > return FWTS_ABORTED; > } > diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c > index 6cd4a05b..c584c50f 100644 > --- a/src/uefi/uefidump/uefidump.c > +++ b/src/uefi/uefidump/uefidump.c > @@ -1523,7 +1523,7 @@ static void uefidump_var(fwts_framework *fw, fwts_uefi_var *var) > > static int uefidump_init(fwts_framework *fw) > { > - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { > + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { > fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); > return FWTS_ABORTED; > } > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpi/boot/boot.c b/src/acpi/boot/boot.c index cd41452f..ffbd2cd1 100644 --- a/src/acpi/boot/boot.c +++ b/src/acpi/boot/boot.c @@ -35,7 +35,7 @@ static int boot_init(fwts_framework *fw) fwts_log_error(fw, "Cannot read ACPI tables."); return FWTS_ERROR; } - if (fwts_firmware_detect() == FWTS_FIRMWARE_UEFI) { + if (fw->firmware_type == FWTS_FIRMWARE_UEFI) { fwts_log_error(fw, "ACPI BOOT table is deprecated on UEFI firmware, skipping test"); return FWTS_SKIP; } diff --git a/src/lib/src/fwts_efi_module.c b/src/lib/src/fwts_efi_module.c index 3756d614..c1bc5ea1 100644 --- a/src/lib/src/fwts_efi_module.c +++ b/src/lib/src/fwts_efi_module.c @@ -214,7 +214,7 @@ int fwts_lib_efi_runtime_kernel_lockdown(fwts_framework *fw) int fwts_lib_efi_runtime_module_init(fwts_framework *fw, int *fd) { - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); return FWTS_ABORTED; } diff --git a/src/opal/power_mgmt_info.c b/src/opal/power_mgmt_info.c index f53525d2..dc0c79f6 100644 --- a/src/opal/power_mgmt_info.c +++ b/src/opal/power_mgmt_info.c @@ -84,7 +84,7 @@ static int power_mgmt_init(fwts_framework *fw) { int ret; - if (fwts_firmware_detect() != FWTS_FIRMWARE_OPAL) { + if (fw->firmware_type != FWTS_FIRMWARE_OPAL) { fwts_skipped(fw, "The firmware type detected was non OPAL " "so skipping the OPAL Power Management DT checks."); diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c index 2195f2aa..53274951 100644 --- a/src/opal/reserv_mem.c +++ b/src/opal/reserv_mem.c @@ -105,7 +105,7 @@ static char *make_message(const char *fmt, ...) static int reserv_mem_init(fwts_framework *fw) { - if (fwts_firmware_detect() != FWTS_FIRMWARE_OPAL) { + if (fw->firmware_type != FWTS_FIRMWARE_OPAL) { fwts_skipped(fw, "The firmware type detected was non OPAL " "so skipping the OPAL Reserve Memory DT checks."); diff --git a/src/uefi/csm/csm.c b/src/uefi/csm/csm.c index 372b2919..b26e9c3c 100644 --- a/src/uefi/csm/csm.c +++ b/src/uefi/csm/csm.c @@ -45,7 +45,7 @@ static int csm_test1(fwts_framework *fw) fwts_log_info(fw, "Checking for UEFI Compatibility Support Module (CSM)"); - if (fwts_firmware_detect() == FWTS_FIRMWARE_UEFI) + if (fw->firmware_type == FWTS_FIRMWARE_UEFI) flag |= EFI_SUPPORT; /* Get Int 10h vector from segment/offset realmode address */ diff --git a/src/uefi/esrt/esrt.c b/src/uefi/esrt/esrt.c index 7193ef8c..8d613bcb 100644 --- a/src/uefi/esrt/esrt.c +++ b/src/uefi/esrt/esrt.c @@ -40,7 +40,7 @@ static int esrt_init(fwts_framework *fw) { - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); return FWTS_ABORTED; } diff --git a/src/uefi/esrtdump/esrtdump.c b/src/uefi/esrtdump/esrtdump.c index 68e5993b..ff4e40eb 100644 --- a/src/uefi/esrtdump/esrtdump.c +++ b/src/uefi/esrtdump/esrtdump.c @@ -32,7 +32,7 @@ static int esrtdump_init(fwts_framework *fw) { - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); return FWTS_ABORTED; } diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c index 417d36c3..cb942020 100644 --- a/src/uefi/uefibootpath/uefibootpath.c +++ b/src/uefi/uefibootpath/uefibootpath.c @@ -35,7 +35,7 @@ static inline bool uefibootpath_check_pnpid(uint32_t id) static int uefibootpath_init(fwts_framework *fw) { - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); return FWTS_ABORTED; } diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c index 6cd4a05b..c584c50f 100644 --- a/src/uefi/uefidump/uefidump.c +++ b/src/uefi/uefidump/uefidump.c @@ -1523,7 +1523,7 @@ static void uefidump_var(fwts_framework *fw, fwts_uefi_var *var) static int uefidump_init(fwts_framework *fw) { - if (fwts_firmware_detect() != FWTS_FIRMWARE_UEFI) { + if (fw->firmware_type != FWTS_FIRMWARE_UEFI) { fwts_log_info(fw, "Cannot detect any UEFI firmware. Aborted."); return FWTS_ABORTED; }
They are used interchangabley in fwts and let's stick with one for readability and save some CPU cycles. There are no functional changes. Signed-off-by: Alex Hung <alex.hung@canonical.com> --- src/acpi/boot/boot.c | 2 +- src/lib/src/fwts_efi_module.c | 2 +- src/opal/power_mgmt_info.c | 2 +- src/opal/reserv_mem.c | 2 +- src/uefi/csm/csm.c | 2 +- src/uefi/esrt/esrt.c | 2 +- src/uefi/esrtdump/esrtdump.c | 2 +- src/uefi/uefibootpath/uefibootpath.c | 2 +- src/uefi/uefidump/uefidump.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-)