[PATCH] drm/nouveau: gk20a: Fix type of dividend in do_div()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Thierry Reding <treding@xxxxxxxxxx>

The semantics of do_div() are (see include/asm-generic/div64.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/nouveau/core/subdev/clock/gk20a.o
	In file included from arch/xtensa/include/generated/asm/div64.h:1:0,
	                 from include/linux/kernel.h:124,
	                 from include/linux/list.h:8,
	                 from include/linux/preempt.h:10,
	                 from include/linux/spinlock.h:50,
	                 from include/linux/mmzone.h:7,
	                 from include/linux/gfp.h:5,
	                 from include/linux/slab.h:14,
	                 from drivers/gpu/drm/nouveau/core/os.h:5,
	                 from drivers/gpu/drm/nouveau/core/include/core/object.h:4,
	                 from drivers/gpu/drm/nouveau/core/include/core/device.h:4,
	                 from drivers/gpu/drm/nouveau/core/include/subdev/clock.h:4,
	                 from drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c:90:
	drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c: In function 'gk20a_pllg_calc_rate':
	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/nouveau/core/subdev/clock/gk20a.c:146:2: note: in expansion of macro 'do_div'
	  do_div(rate, divider);
	  ^
	drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c:146:2: warning: right shift count >= width of type
	In file included from arch/xtensa/include/generated/asm/div64.h:1:0,
	                 from include/linux/kernel.h:124,
	                 from include/linux/list.h:8,
	                 from include/linux/preempt.h:10,
	                 from include/linux/spinlock.h:50,
	                 from include/linux/mmzone.h:7,
	                 from include/linux/gfp.h:5,
	                 from include/linux/slab.h:14,
	                 from drivers/gpu/drm/nouveau/core/os.h:5,
	                 from drivers/gpu/drm/nouveau/core/include/core/object.h:4,
	                 from drivers/gpu/drm/nouveau/core/include/core/device.h:4,
	                 from drivers/gpu/drm/nouveau/core/include/subdev/clock.h:4,
	                 from drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c:90:
	include/asm-generic/div64.h:48:11: warning: passing argument 1 of '__div64_32' from incompatible pointer type
	   __rem = __div64_32(&(n), __base); \
	           ^
	drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c:146:2: note: in expansion of macro 'do_div'
	  do_div(rate, divider);
	  ^
	include/asm-generic/div64.h:35:17: note: expected 'uint64_t *' but argument is of type 'u32 *'
	 extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);

Signed-off-by: Thierry Reding <treding@xxxxxxxxxx>
---
 drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c b/drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c
index 425a8d5e9129..c571437afbd2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/gk20a.c
@@ -138,7 +138,7 @@ gk20a_pllg_read_mnp(struct gk20a_clock_priv *priv)
 static u32
 gk20a_pllg_calc_rate(struct gk20a_clock_priv *priv)
 {
-	u32 rate;
+	u64 rate;
 	u32 divider;
 
 	rate = priv->parent_rate * priv->n;
-- 
2.1.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux