[linux-dvb] [PATCH]: second attempt to fix 64-bit warning in saa7146_hlp.c

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

 



OK, after receiving some comments about my fix in saa7146_hlp.c I'm submitting
it again (and this time to the list first, my apologies for not doing that
before) and this time with the comment I should have added in the first place.

I didn't just hide a warning, I actually thought about it :-)

Regards,

	Hans

Signed-off-by: Hans Verkuil <hverkuil@xxxxxxxxx>

Index: linux/drivers/media/common/saa7146_hlp.c
===================================================================
RCS file: /cvs/video4linux/v4l-dvb/linux/drivers/media/common/saa7146_hlp.c,v
retrieving revision 1.35
diff -u -r1.35 saa7146_hlp.c
--- linux/drivers/media/common/saa7146_hlp.c	19 Dec 2005 09:37:26 -0000	1.35
+++ linux/drivers/media/common/saa7146_hlp.c	19 Dec 2005 09:43:52 -0000
@@ -563,19 +563,22 @@
 
 	int b_depth = vv->ov_fmt->depth;
 	int b_bpl = vv->ov_fb.fmt.bytesperline;
-	u32 base = (u32)vv->ov_fb.base;
+	/* The base pointer is a 32-bit pointer into DMA memory.
+	   The unsigned long cast is to remove a 64-bit compile warning since
+	   it looks like a 64-bit address is cast to a 32-bit value. */
+	u32 base = (u32)(unsigned long)vv->ov_fb.base;
 
 	struct	saa7146_video_dma vdma1;
 
 	/* calculate memory offsets for picture, look if we shall top-down-flip */
 	vdma1.pitch	= 2*b_bpl;
 	if ( 0 == vv->vflip ) {
-		vdma1.base_even = (u32)base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
+		vdma1.base_even = base + (w_y * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
 		vdma1.base_odd  = vdma1.base_even + (vdma1.pitch / 2);
 		vdma1.prot_addr = vdma1.base_even + (w_height * (vdma1.pitch / 2));
 	}
 	else {
-		vdma1.base_even = (u32)base + ((w_y+w_height) * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
+		vdma1.base_even = base + ((w_y+w_height) * (vdma1.pitch/2)) + (w_x * (b_depth / 8));
 		vdma1.base_odd  = vdma1.base_even - (vdma1.pitch / 2);
 		vdma1.prot_addr = vdma1.base_odd - (w_height * (vdma1.pitch / 2));
 	}


[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux