patch-2.4.26 linux-2.4.26/drivers/media/video/meye.c
Next file: linux-2.4.26/drivers/media/video/meye.h
Previous file: linux-2.4.26/drivers/media/video/Config.in
Back to the patch index
Back to the overall index
- Lines: 90
- Date:
2004-04-14 06:05:30.000000000 -0700
- Orig file:
linux-2.4.25/drivers/media/video/meye.c
- Orig date:
2003-11-28 10:26:20.000000000 -0800
diff -urN linux-2.4.25/drivers/media/video/meye.c linux-2.4.26/drivers/media/video/meye.c
@@ -188,23 +188,31 @@
free_pages((unsigned long)vaddr, get_order(size));
}
-/* return a page table pointing to N pages of locked memory */
+/*
+ * return a page table pointing to N pages of locked memory
+ *
+ * NOTE: The meye device expects dma_addr_t size to be 32 bits
+ * (the toc must be exactly 1024 entries each of them being 4 bytes
+ * in size, the whole result being 4096 bytes). We're using here
+ * dma_addr_t for correctness but the compilation of this driver is
+ * disabled for HIGHMEM64G=y, where sizeof(dma_addr_t) != 4
+ */
static int ptable_alloc(void) {
- u32 *pt;
+ dma_addr_t *pt;
int i;
memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable));
- meye.mchip_ptable[MCHIP_NB_PAGES] = dma_alloc_coherent(meye.mchip_dev,
- PAGE_SIZE,
- &meye.mchip_dmahandle,
- GFP_KERNEL);
- if (!meye.mchip_ptable[MCHIP_NB_PAGES]) {
+ meye.mchip_ptable_toc = dma_alloc_coherent(meye.mchip_dev,
+ PAGE_SIZE,
+ &meye.mchip_dmahandle,
+ GFP_KERNEL);
+ if (!meye.mchip_ptable_toc) {
meye.mchip_dmahandle = 0;
return -1;
}
- pt = (u32 *)meye.mchip_ptable[MCHIP_NB_PAGES];
+ pt = meye.mchip_ptable_toc;
for (i = 0; i < MCHIP_NB_PAGES; i++) {
meye.mchip_ptable[i] = dma_alloc_coherent(meye.mchip_dev,
PAGE_SIZE,
@@ -212,13 +220,18 @@
GFP_KERNEL);
if (!meye.mchip_ptable[i]) {
int j;
- pt = (u32 *)meye.mchip_ptable[MCHIP_NB_PAGES];
+ pt = meye.mchip_ptable_toc;
for (j = 0; j < i; ++j) {
dma_free_coherent(meye.mchip_dev,
PAGE_SIZE,
meye.mchip_ptable[j], *pt);
pt++;
}
+ dma_free_coherent(meye.mchip_dev,
+ PAGE_SIZE,
+ meye.mchip_ptable_toc,
+ meye.mchip_dmahandle);
+ meye.mchip_ptable_toc = 0;
meye.mchip_dmahandle = 0;
return -1;
}
@@ -228,10 +241,10 @@
}
static void ptable_free(void) {
- u32 *pt;
+ dma_addr_t *pt;
int i;
- pt = (u32 *)meye.mchip_ptable[MCHIP_NB_PAGES];
+ pt = meye.mchip_ptable_toc;
for (i = 0; i < MCHIP_NB_PAGES; i++) {
if (meye.mchip_ptable[i])
dma_free_coherent(meye.mchip_dev,
@@ -240,13 +253,14 @@
pt++;
}
- if (meye.mchip_ptable[MCHIP_NB_PAGES])
+ if (meye.mchip_ptable_toc)
dma_free_coherent(meye.mchip_dev,
PAGE_SIZE,
- meye.mchip_ptable[MCHIP_NB_PAGES],
+ meye.mchip_ptable_toc,
meye.mchip_dmahandle);
memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable));
+ meye.mchip_ptable_toc = 0;
meye.mchip_dmahandle = 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)