[linux-dvb] FYI: CinergyT2 and embeded enviroment

Johannes Stezenbach js at linuxtv.org
Mon Apr 4 02:05:13 CEST 2005


Johannes Stezenbach wrote:
> Since the cinergyT2 driver doesn't take care of handling
> DMA vs. cache consistency (it leaves this job to the usb core),
> it should just use kmalloc().

I suggest the following patch:

Index: drivers/media/dvb/cinergyT2/cinergyT2.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/cinergyT2/cinergyT2.c,v
retrieving revision 1.23
diff -u -p -r1.23 cinergyT2.c
--- drivers/media/dvb/cinergyT2/cinergyT2.c	17 Mar 2005 03:14:25 -0000	1.23
+++ drivers/media/dvb/cinergyT2/cinergyT2.c	4 Apr 2005 00:03:07 -0000
@@ -28,9 +28,9 @@
 #include <linux/version.h>
 #include <linux/slab.h>
 #include <linux/usb.h>
-#include <linux/pci.h>
 #include <linux/input.h>
 #include <linux/dvb/frontend.h>
+#include <asm/io.h>
 
 #include "dmxdev.h"
 #include "dvb_demux.h"
@@ -142,7 +142,6 @@ struct cinergyt2 {
 	int pending_fe_events;
 
 	void *streambuf;
-	dma_addr_t streambuf_dmahandle;
 	struct urb *stream_urb [STREAM_URB_COUNT];
 
 #ifdef ENABLE_RC
@@ -282,19 +281,16 @@ static void cinergyt2_free_stream_urbs (
 		if (cinergyt2->stream_urb[i])
 			usb_free_urb(cinergyt2->stream_urb[i]);
 
-	pci_free_consistent(NULL, STREAM_URB_COUNT*STREAM_BUF_SIZE,
-			    cinergyt2->streambuf, cinergyt2->streambuf_dmahandle);
+	kfree(cinergyt2->streambuf);
 }
 
 static int cinergyt2_alloc_stream_urbs (struct cinergyt2 *cinergyt2)
 {
 	int i;
 
-	cinergyt2->streambuf = pci_alloc_consistent(NULL,
-					      STREAM_URB_COUNT*STREAM_BUF_SIZE,
-					      &cinergyt2->streambuf_dmahandle);
+	cinergyt2->streambuf = kmalloc(STREAM_URB_COUNT*STREAM_BUF_SIZE, GFP_KERNEL);
 	if (!cinergyt2->streambuf) {
-		dprintk(1, "failed to alloc consistent stream memory area, bailing out!\n");
+		dprintk(1, "failed to alloc stream memory area, bailing out!\n");
 		return -ENOMEM;
 	}
 
@@ -304,7 +300,7 @@ static int cinergyt2_alloc_stream_urbs (
 		struct urb *urb;
 
 		if (!(urb = usb_alloc_urb(0, GFP_ATOMIC))) {
-			dprintk(1, "failed to alloc consistent stream urbs, bailing out!\n");
+			dprintk(1, "failed to alloc stream urbs, bailing out!\n");
 			cinergyt2_free_stream_urbs(cinergyt2);
 			return -ENOMEM;
 		}

Johannes




More information about the linux-dvb mailing list