[PATCH] amdgpu/dc: use kernel ilog2 for log_2.

Harry Wentland harry.wentland at amd.com
Tue Oct 3 13:52:28 UTC 2017


On 2017-10-02 11:14 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This should produce the same result.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Reviewed-by: Harry Wentland <harry.wentland at amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/dc/basics/conversion.c | 10 ----------
>  drivers/gpu/drm/amd/display/dc/basics/conversion.h |  5 ++++-
>  2 files changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/basics/conversion.c b/drivers/gpu/drm/amd/display/dc/basics/conversion.c
> index a2e22ae..23c9a0e 100644
> --- a/drivers/gpu/drm/amd/display/dc/basics/conversion.c
> +++ b/drivers/gpu/drm/amd/display/dc/basics/conversion.c
> @@ -102,13 +102,3 @@ void convert_float_matrix(
>  		matrix[i] = (uint16_t)reg_value;
>  	}
>  }
> -
> -unsigned int log_2(unsigned int num)
> -{
> -	unsigned int result = 0;
> -
> -	while ((num >>= 1) != 0)
> -		result++;
> -
> -	return result;
> -}
> diff --git a/drivers/gpu/drm/amd/display/dc/basics/conversion.h b/drivers/gpu/drm/amd/display/dc/basics/conversion.h
> index 189325f..ade785c 100644
> --- a/drivers/gpu/drm/amd/display/dc/basics/conversion.h
> +++ b/drivers/gpu/drm/amd/display/dc/basics/conversion.h
> @@ -38,6 +38,9 @@ void convert_float_matrix(
>  	struct fixed31_32 *flt,
>  	uint32_t buffer_size);
>  
> -unsigned int log_2(unsigned int num);
> +static inline unsigned int log_2(unsigned int num)
> +{
> +	return ilog2(num);
> +}
>  
>  #endif
> 


More information about the amd-gfx mailing list