[PATCH] amdgpu/dc: use kernel ilog2 for log_2.
Dave Airlie
airlied at gmail.com
Tue Oct 3 03:14:36 UTC 2017
From: Dave Airlie <airlied at redhat.com>
This should produce the same result.
Signed-off-by: Dave Airlie <airlied at 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
More information about the amd-gfx
mailing list