All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] amdgpu/dc: use kernel ilog2 for log_2.
@ 2017-10-03  3:14 Dave Airlie
       [not found] ` <20171003031436.20269-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2017-10-03  3:14 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This should produce the same result.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 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
-- 
2.9.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] amdgpu/dc: use kernel ilog2 for log_2.
       [not found] ` <20171003031436.20269-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-10-03 13:52   ` Harry Wentland
  0 siblings, 0 replies; 2+ messages in thread
From: Harry Wentland @ 2017-10-03 13:52 UTC (permalink / raw)
  To: Dave Airlie, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Reviewed-by: Harry Wentland <harry.wentland@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
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-03 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03  3:14 [PATCH] amdgpu/dc: use kernel ilog2 for log_2 Dave Airlie
     [not found] ` <20171003031436.20269-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03 13:52   ` Harry Wentland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.