mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/mgag200: Fix type of dividend in do_div()
Date: Thu,  2 Oct 2014 09:29:46 +0200	[thread overview]
Message-ID: <1412234986-2001-1-git-send-email-thierry.reding@gmail.com> (raw)

From: Thierry Reding <treding@nvidia.com>

The semantics of do_div() are (see include/asm-generic/do_div.h):

	uint32_t do_div(uint64_t *n, uint32_t base)

Using a different type will therefore cause the following warning (as
seen on xtensa/allmodconfig):

	  CC [M]  drivers/gpu/drm/mgag200/mgag200_mode.o
	In file included from arch/xtensa/include/generated/asm/div64.h:1:0,
	                 from include/linux/kernel.h:124,
	                 from include/linux/delay.h:10,
	                 from drivers/gpu/drm/mgag200/mgag200_mode.c:14:
	drivers/gpu/drm/mgag200/mgag200_mode.c: In function 'mga_vga_calculate_mode_bandwidth':
	include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast
	  (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
	                            ^
	drivers/gpu/drm/mgag200/mgag200_mode.c:1471:2: note: in expansion of macro 'do_div'
	  do_div(pixels_per_second, total_area);
	  ^
	include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast
	  (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
	                            ^
	drivers/gpu/drm/mgag200/mgag200_mode.c:1474:2: note: in expansion of macro 'do_div'
	  do_div(bandwidth, divisor);
	  ^

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 83485ab81ce8..4d519dc99db8 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1455,9 +1455,9 @@ static int mga_vga_get_modes(struct drm_connector *connector)
 static uint32_t mga_vga_calculate_mode_bandwidth(struct drm_display_mode *mode,
 							int bits_per_pixel)
 {
-	uint32_t total_area, divisor;
-	int64_t active_area, pixels_per_second, bandwidth;
 	uint64_t bytes_per_pixel = (bits_per_pixel + 7) / 8;
+	uint32_t total_area, divisor, active_area;
+	uint64_t pixels_per_second, bandwidth;
 
 	divisor = 1024;
 
-- 
2.1.0


                 reply	other threads:[~2014-10-02  7:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1412234986-2001-1-git-send-email-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®