diff mbox series

[4/4] uefi: remove unused have_rtsupported

Message ID 20210507095623.34254-4-ivan.hu@canonical.com
State Accepted
Headers show
Series [1/4] uefirttime: only test the unsupported status with RuntimeServicesSupported | expand

Commit Message

ivanhu May 7, 2021, 9:56 a.m. UTC
Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/include/fwts_uefi.h              | 2 +-
 src/lib/src/fwts_uefi.c                  | 8 ++------
 src/uefi/uefirtmisc/uefirtmisc.c         | 4 +---
 src/uefi/uefirttime/uefirttime.c         | 4 +---
 src/uefi/uefirtvariable/uefirtvariable.c | 4 +---
 5 files changed, 6 insertions(+), 16 deletions(-)

Comments

Colin Ian King May 7, 2021, 10:40 a.m. UTC | #1
On 07/05/2021 10:56, Ivan Hu wrote:
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h              | 2 +-
>  src/lib/src/fwts_uefi.c                  | 8 ++------
>  src/uefi/uefirtmisc/uefirtmisc.c         | 4 +---
>  src/uefi/uefirttime/uefirttime.c         | 4 +---
>  src/uefi/uefirtvariable/uefirtvariable.c | 4 +---
>  5 files changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 8d7a711b..cb6c297c 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -682,7 +682,7 @@ char *fwts_uefi_attribute_info(uint32_t attr);
>  
>  bool fwts_uefi_efivars_iface_exist(void);
>  
> -void fwts_uefi_rt_support_status_get(int fd, bool *have_rtsupported, uint32_t *rtservicessupported);
> +void fwts_uefi_rt_support_status_get(int fd, uint32_t *rtservicessupported);
>  PRAGMA_POP
>  
>  #endif
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index 03ff8356..101d04cf 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -550,17 +550,13 @@ bool fwts_uefi_efivars_iface_exist(void)
>   *	this bitmask can be read via an IOCTL call. Before Linux 5.11 the value
>   *	cannot be determined.
>   */
> -void fwts_uefi_rt_support_status_get(int fd, bool *have_rtsupported, uint32_t *rtservicessupported)
> +void fwts_uefi_rt_support_status_get(int fd, uint32_t *rtservicessupported)
>  {
>  	long ioret;
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_SUPPORTED_MASK, rtservicessupported);
> -	if (ioret == -1) {
> -		*have_rtsupported = false;
> +	if (ioret == -1)
>  		*rtservicessupported = EFI_RT_SUPPORTED_ALL;
> -	} else {
> -		*have_rtsupported = true;
> -	}
>  
>  	return;
>  }
> diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
> index bdeaf76d..580f92ac 100644
> --- a/src/uefi/uefirtmisc/uefirtmisc.c
> +++ b/src/uefi/uefirtmisc/uefirtmisc.c
> @@ -43,7 +43,6 @@
>  static int fd;
>  static EFI_GUID gEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID;
>  
> -static bool have_rtsupported;
>  static uint32_t runtimeservicessupported;
>  
>  static int uefirtmisc_init(fwts_framework *fw)
> @@ -51,8 +50,7 @@ static int uefirtmisc_init(fwts_framework *fw)
>  	if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
>  		return FWTS_ABORTED;
>  
> -	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
> -			&runtimeservicessupported);
> +	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
>  
>  	return FWTS_OK;
>  }
> diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
> index 00326139..e2ab7d61 100644
> --- a/src/uefi/uefirttime/uefirttime.c
> +++ b/src/uefi/uefirttime/uefirttime.c
> @@ -38,7 +38,6 @@
>  static int fd;
>  static const uint32_t dayofmonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
>  
> -static bool have_rtsupported;
>  static uint32_t runtimeservicessupported;
>  
>  static bool dayvalid(EFI_TIME *Time)
> @@ -175,8 +174,7 @@ static int uefirttime_init(fwts_framework *fw)
>  	if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
>  		return FWTS_ABORTED;
>  
> -	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
> -			&runtimeservicessupported);
> +	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
>  
>  	return FWTS_OK;
>  }
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 2b677513..db0e80bb 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -64,7 +64,6 @@ static uint16_t variablenametest[] = {'T', 'e', 's', 't', 'v', 'a', 'r', '\0'};
>  static uint16_t variablenametest2[] = {'T', 'e', 's', 't', 'v', 'a', 'r', ' ', '\0'};
>  static uint16_t variablenametest3[] = {'T', 'e', 's', 't', 'v', 'a', '\0'};
>  
> -static bool have_rtsupported;
>  static uint32_t runtimeservicessupported;
>  
>  static void uefirtvariable_env_cleanup(void)
> @@ -103,8 +102,7 @@ static int uefirtvariable_init(fwts_framework *fw)
>  
>  	uefirtvariable_env_cleanup();
>  
> -	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
> -			&runtimeservicessupported);
> +	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
>  
>  	return FWTS_OK;
>  }
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung May 7, 2021, 5:59 p.m. UTC | #2
On 2021-05-07 3:56 a.m., Ivan Hu wrote:
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/include/fwts_uefi.h              | 2 +-
>  src/lib/src/fwts_uefi.c                  | 8 ++------
>  src/uefi/uefirtmisc/uefirtmisc.c         | 4 +---
>  src/uefi/uefirttime/uefirttime.c         | 4 +---
>  src/uefi/uefirtvariable/uefirtvariable.c | 4 +---
>  5 files changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
> index 8d7a711b..cb6c297c 100644
> --- a/src/lib/include/fwts_uefi.h
> +++ b/src/lib/include/fwts_uefi.h
> @@ -682,7 +682,7 @@ char *fwts_uefi_attribute_info(uint32_t attr);
>  
>  bool fwts_uefi_efivars_iface_exist(void);
>  
> -void fwts_uefi_rt_support_status_get(int fd, bool *have_rtsupported, uint32_t *rtservicessupported);
> +void fwts_uefi_rt_support_status_get(int fd, uint32_t *rtservicessupported);
>  PRAGMA_POP
>  
>  #endif
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index 03ff8356..101d04cf 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -550,17 +550,13 @@ bool fwts_uefi_efivars_iface_exist(void)
>   *	this bitmask can be read via an IOCTL call. Before Linux 5.11 the value
>   *	cannot be determined.
>   */
> -void fwts_uefi_rt_support_status_get(int fd, bool *have_rtsupported, uint32_t *rtservicessupported)
> +void fwts_uefi_rt_support_status_get(int fd, uint32_t *rtservicessupported)
>  {
>  	long ioret;
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_SUPPORTED_MASK, rtservicessupported);
> -	if (ioret == -1) {
> -		*have_rtsupported = false;
> +	if (ioret == -1)
>  		*rtservicessupported = EFI_RT_SUPPORTED_ALL;
> -	} else {
> -		*have_rtsupported = true;
> -	}
>  
>  	return;
>  }
> diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
> index bdeaf76d..580f92ac 100644
> --- a/src/uefi/uefirtmisc/uefirtmisc.c
> +++ b/src/uefi/uefirtmisc/uefirtmisc.c
> @@ -43,7 +43,6 @@
>  static int fd;
>  static EFI_GUID gEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID;
>  
> -static bool have_rtsupported;
>  static uint32_t runtimeservicessupported;
>  
>  static int uefirtmisc_init(fwts_framework *fw)
> @@ -51,8 +50,7 @@ static int uefirtmisc_init(fwts_framework *fw)
>  	if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
>  		return FWTS_ABORTED;
>  
> -	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
> -			&runtimeservicessupported);
> +	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
>  
>  	return FWTS_OK;
>  }
> diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
> index 00326139..e2ab7d61 100644
> --- a/src/uefi/uefirttime/uefirttime.c
> +++ b/src/uefi/uefirttime/uefirttime.c
> @@ -38,7 +38,6 @@
>  static int fd;
>  static const uint32_t dayofmonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
>  
> -static bool have_rtsupported;
>  static uint32_t runtimeservicessupported;
>  
>  static bool dayvalid(EFI_TIME *Time)
> @@ -175,8 +174,7 @@ static int uefirttime_init(fwts_framework *fw)
>  	if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
>  		return FWTS_ABORTED;
>  
> -	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
> -			&runtimeservicessupported);
> +	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
>  
>  	return FWTS_OK;
>  }
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 2b677513..db0e80bb 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -64,7 +64,6 @@ static uint16_t variablenametest[] = {'T', 'e', 's', 't', 'v', 'a', 'r', '\0'};
>  static uint16_t variablenametest2[] = {'T', 'e', 's', 't', 'v', 'a', 'r', ' ', '\0'};
>  static uint16_t variablenametest3[] = {'T', 'e', 's', 't', 'v', 'a', '\0'};
>  
> -static bool have_rtsupported;
>  static uint32_t runtimeservicessupported;
>  
>  static void uefirtvariable_env_cleanup(void)
> @@ -103,8 +102,7 @@ static int uefirtvariable_init(fwts_framework *fw)
>  
>  	uefirtvariable_env_cleanup();
>  
> -	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
> -			&runtimeservicessupported);
> +	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
>  
>  	return FWTS_OK;
>  }
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h
index 8d7a711b..cb6c297c 100644
--- a/src/lib/include/fwts_uefi.h
+++ b/src/lib/include/fwts_uefi.h
@@ -682,7 +682,7 @@  char *fwts_uefi_attribute_info(uint32_t attr);
 
 bool fwts_uefi_efivars_iface_exist(void);
 
-void fwts_uefi_rt_support_status_get(int fd, bool *have_rtsupported, uint32_t *rtservicessupported);
+void fwts_uefi_rt_support_status_get(int fd, uint32_t *rtservicessupported);
 PRAGMA_POP
 
 #endif
diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
index 03ff8356..101d04cf 100644
--- a/src/lib/src/fwts_uefi.c
+++ b/src/lib/src/fwts_uefi.c
@@ -550,17 +550,13 @@  bool fwts_uefi_efivars_iface_exist(void)
  *	this bitmask can be read via an IOCTL call. Before Linux 5.11 the value
  *	cannot be determined.
  */
-void fwts_uefi_rt_support_status_get(int fd, bool *have_rtsupported, uint32_t *rtservicessupported)
+void fwts_uefi_rt_support_status_get(int fd, uint32_t *rtservicessupported)
 {
 	long ioret;
 
 	ioret = ioctl(fd, EFI_RUNTIME_GET_SUPPORTED_MASK, rtservicessupported);
-	if (ioret == -1) {
-		*have_rtsupported = false;
+	if (ioret == -1)
 		*rtservicessupported = EFI_RT_SUPPORTED_ALL;
-	} else {
-		*have_rtsupported = true;
-	}
 
 	return;
 }
diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
index bdeaf76d..580f92ac 100644
--- a/src/uefi/uefirtmisc/uefirtmisc.c
+++ b/src/uefi/uefirtmisc/uefirtmisc.c
@@ -43,7 +43,6 @@ 
 static int fd;
 static EFI_GUID gEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID;
 
-static bool have_rtsupported;
 static uint32_t runtimeservicessupported;
 
 static int uefirtmisc_init(fwts_framework *fw)
@@ -51,8 +50,7 @@  static int uefirtmisc_init(fwts_framework *fw)
 	if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
 		return FWTS_ABORTED;
 
-	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
-			&runtimeservicessupported);
+	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
 
 	return FWTS_OK;
 }
diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
index 00326139..e2ab7d61 100644
--- a/src/uefi/uefirttime/uefirttime.c
+++ b/src/uefi/uefirttime/uefirttime.c
@@ -38,7 +38,6 @@ 
 static int fd;
 static const uint32_t dayofmonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
 
-static bool have_rtsupported;
 static uint32_t runtimeservicessupported;
 
 static bool dayvalid(EFI_TIME *Time)
@@ -175,8 +174,7 @@  static int uefirttime_init(fwts_framework *fw)
 	if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
 		return FWTS_ABORTED;
 
-	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
-			&runtimeservicessupported);
+	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
 
 	return FWTS_OK;
 }
diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 2b677513..db0e80bb 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -64,7 +64,6 @@  static uint16_t variablenametest[] = {'T', 'e', 's', 't', 'v', 'a', 'r', '\0'};
 static uint16_t variablenametest2[] = {'T', 'e', 's', 't', 'v', 'a', 'r', ' ', '\0'};
 static uint16_t variablenametest3[] = {'T', 'e', 's', 't', 'v', 'a', '\0'};
 
-static bool have_rtsupported;
 static uint32_t runtimeservicessupported;
 
 static void uefirtvariable_env_cleanup(void)
@@ -103,8 +102,7 @@  static int uefirtvariable_init(fwts_framework *fw)
 
 	uefirtvariable_env_cleanup();
 
-	fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
-			&runtimeservicessupported);
+	fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported);
 
 	return FWTS_OK;
 }