Skip to contentSkip to conversation

saa716x: don't cast pointers to 32bit int

PATCH Applied Luca Tettamanti 3 participants 3 messages Jan 5, 2009 – Jan 30, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 saa716x: don't cast pointers to 32bit int

Pointers may be 64bit long, casting them to u32 is wrong.
For doing math on the address unsigned long is guaranteed to have to correct size to hold the value of the pointer.

---
Patch applies to HG repo.

 linux/drivers/media/dvb/saa716x/saa716x_dma.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
linux/drivers/media/dvb/saa716x/saa716x_dma.c +3 -3
Index: saa716x/linux/drivers/media/dvb/saa716x/saa716x_dma.c
===================================================================
@@ -34,7 +34,7 @@
 		return -ENOMEM;
 	}
 
-	BUG_ON(!(((u32) dmabuf->mem_ptab_phys % SAA716x_PAGE_SIZE) == 0));
+	BUG_ON(!(((unsigned long) dmabuf->mem_ptab_phys % SAA716x_PAGE_SIZE) == 0));
 
 	return 0;
 }
@@ -126,9 +126,9 @@
 		}
 
 		/* align memory to page */
-		dmabuf->mem_virt = (void *) PAGE_ALIGN (((u32) dmabuf->mem_virt_noalign));
+		dmabuf->mem_virt = (void *) PAGE_ALIGN (((unsigned long) dmabuf->mem_virt_noalign));
 
-		BUG_ON(!((((u32) dmabuf->mem_virt) % SAA716x_PAGE_SIZE) == 0));
+		BUG_ON(!((((unsigned long) dmabuf->mem_virt) % SAA716x_PAGE_SIZE) == 0));
 	} else {
 		dmabuf->mem_virt = buf;
 	}

Luca

Signature · 7 lines
Porc i' mond che cio' sott i piedi!
V. Catozzo

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
Applied
#1 lore raw
Quoted 27 lines · Luca Tettamanti

Pointers may be 64bit long, casting them to u32 is wrong.
For doing math on the address unsigned long is guaranteed to have to correct size to hold the value of the pointer.

---
Patch applies to HG repo.

 linux/drivers/media/dvb/saa716x/saa716x_dma.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: saa716x/linux/drivers/media/dvb/saa716x/saa716x_dma.c
===================================================================

linux/drivers/media/dvb/saa716x/saa716x_dma.c +1 -1
@@ -34,7 +34,7 @@
 		return -ENOMEM;
 	}
 
-	BUG_ON(!(((u32) dmabuf->mem_ptab_phys % SAA716x_PAGE_SIZE) == 0));
+	BUG_ON(!(((unsigned long) dmabuf->mem_ptab_phys % SAA716x_PAGE_SIZE) == 0));
 
 	return 0;
 }
@@ -126,9 +126,9 @@
 		}

linux/drivers/media/dvb/saa716x/saa716x_dma.c line 134

Quoted 10 lines
linux/drivers/media/dvb/saa716x/saa716x_dma.c +2 -2
 
 		/* align memory to page */
-		dmabuf->mem_virt = (void *) PAGE_ALIGN (((u32) dmabuf->mem_virt_noalign));
+		dmabuf->mem_virt = (void *) PAGE_ALIGN (((unsigned long) dmabuf->mem_virt_noalign));
 
-		BUG_ON(!((((u32) dmabuf->mem_virt) % SAA716x_PAGE_SIZE) == 0));
+		BUG_ON(!((((unsigned long) dmabuf->mem_virt) % SAA716x_PAGE_SIZE) == 0));
 	} else {
 		dmabuf->mem_virt = buf;
 	}

Applied.

Thanks,
Manu

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead [email protected] [email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#2 lore raw

[linux-dvb] saa716x: HC82 does not work

hey,
i have a avermedia hc82. This one should be working with the saa716x driver, but it isnt. Im trying to get it working on a 64bit Ubuntu System. I installed the latest driver and loaded kernel moduls saa716x_core and saa716x_hybrid, but there still is no /dev/dvb directory.
The output of lsmod | grep saa716x is:

saa716x_hybrid         19464  0 
tda1004x               26244  1 saa716x_hybrid
saa716x_core           67892  1 saa716x_hybrid
dvb_core              113324  2 saa716x_hybrid,saa716x_core
i2c_core               36128  2 tda1004x,saa716x_core

so the modules are loaded.
Any ideas? Anything I can do to make it work?

Thanks,
Martin