amdgpu/dc: use kernel ilog2 for log_2.
authorDave Airlie <airlied@redhat.com>
Tue, 3 Oct 2017 03:49:42 +0000 (13:49 +1000)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 6 Oct 2017 17:00:27 +0000 (13:00 -0400)
This should produce the same result.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/basics/conversion.c
drivers/gpu/drm/amd/display/dc/basics/conversion.h

index a2e22ae..23c9a0e 100644 (file)
@@ -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;
-}
index 189325f..ade785c 100644 (file)
@@ -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