AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 1/4] amdgpu/dc: use kernel ilog2 for log_2.
Date: Tue,  3 Oct 2017 13:49:42 +1000	[thread overview]
Message-ID: <20171003034945.27909-1-airlied@gmail.com> (raw)

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

             reply	other threads:[~2017-10-03  3:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03  3:49 Dave Airlie [this message]
     [not found] ` <20171003034945.27909-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03  3:49   ` [PATCH 2/4] amdgpu/dc: drop dce110_types.h Dave Airlie
2017-10-03  3:49   ` [PATCH 3/4] amdgpu/dc: drop hw_sequencer_types.h Dave Airlie
2017-10-03  3:49   ` [PATCH 4/4] amdgpu/dc: remove bitmap implementation in gpio_service Dave Airlie
     [not found]     ` <20171003034945.27909-4-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03 16:10       ` Harry Wentland
2017-10-03 19:29       ` Felix Kuehling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171003034945.27909-1-airlied@gmail.com \
    --to=airlied-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox