ACK: [PATCH 3/4] efi_runtime: Group kernel version dependent functions

Colin Ian King colin.king at canonical.com
Thu Apr 3 16:33:22 UTC 2014


On 03/04/14 15:23, Matt Fleming wrote:
> From: Matt Fleming <matt.fleming at intel.com>
> 
> Instead of using multiple identical #if preprocessor blocks group the
> function calls and implementations together so that we can keep the
> preprocessor checks to a minimum.
> 
> This change also more clearly conveys the message that the two functions
> are dependent on the same kernel version. With multiple #if block it's
> easy to misread them and think that, becuase there's more than one, they
> must have different kernel version requirements.
> 
> Signed-off-by: Matt Fleming <matt.fleming at intel.com>
> ---
>  efi_runtime/efi_runtime.c | 47 ++++++++++++++++++++++-------------------------
>  1 file changed, 22 insertions(+), 25 deletions(-)
> 
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 94be99a0092d..ffe107341470 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -298,6 +298,25 @@ static long efi_runtime_get_nextvariablename(unsigned long arg)
>  	return 0;
>  }
>  
> +static long efi_runtime_get_nexthighmonocount(unsigned long arg)
> +{
> +	struct efi_getnexthighmonotoniccount __user *pgetnexthighmonotoniccount;
> +	efi_status_t status;
> +
> +	pgetnexthighmonotoniccount = (struct
> +			efi_getnexthighmonotoniccount __user *)arg;
> +
> +	status = efi.get_next_high_mono_count(pgetnexthighmonotoniccount
> +							->HighCount);
> +	if (put_user(status, pgetnexthighmonotoniccount->status))
> +		return -EFAULT;
> +	if (status != EFI_SUCCESS)
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +
> +
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
>  static long efi_runtime_query_variableinfo(unsigned long arg)
>  {
> @@ -321,27 +340,7 @@ static long efi_runtime_query_variableinfo(unsigned long arg)
>  
>  	return 0;
>  }
> -#endif
>  
> -static long efi_runtime_get_nexthighmonocount(unsigned long arg)
> -{
> -	struct efi_getnexthighmonotoniccount __user *pgetnexthighmonotoniccount;
> -	efi_status_t status;
> -
> -	pgetnexthighmonotoniccount = (struct
> -			efi_getnexthighmonotoniccount __user *)arg;
> -
> -	status = efi.get_next_high_mono_count(pgetnexthighmonotoniccount
> -							->HighCount);
> -	if (put_user(status, pgetnexthighmonotoniccount->status))
> -		return -EFAULT;
> -	if (status != EFI_SUCCESS)
> -		return -EINVAL;
> -
> -	return 0;
> -}
> -
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
>  static long efi_runtime_query_capsulecaps(unsigned long arg)
>  {
>  	struct efi_querycapsulecapabilities __user *pquerycapsulecapabilities;
> @@ -391,15 +390,13 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd,
>  	case EFI_RUNTIME_GET_NEXTVARIABLENAME:
>  		return efi_runtime_get_nextvariablename(arg);
>  
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
> -	case EFI_RUNTIME_QUERY_VARIABLEINFO:
> -		return efi_runtime_query_variableinfo(arg);
> -#endif
> -
>  	case EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT:
>  		return efi_runtime_get_nexthighmonocount(arg);
>  
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
> +	case EFI_RUNTIME_QUERY_VARIABLEINFO:
> +		return efi_runtime_query_variableinfo(arg);
> +
>  	case EFI_RUNTIME_QUERY_CAPSULECAPABILITIES:
>  		return efi_runtime_query_capsulecaps(arg);
>  #endif
> 
Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list