]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] cx231xx: use URB_NO_TRANSFER_DMA_MAP on URBs allocated with usb_alloc_urb()
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 7 Jan 2012 12:52:37 +0000 (09:52 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 11 Jan 2012 00:38:59 +0000 (22:38 -0200)
URBs allocated with usb_alloc_urb() are allocated from DMA-coherent
areas, and therefore it is not necessary to call dma_map_single() on
such buffers. Worst, on ARM, calling dma_map_single() on a
DMA-coherent buffer will trigger a BUG_ON() in
arch/arm/mm/dma-mapping.c.

Therefore, we mark all URBs allocated with usb_alloc_urb() with the
URB_NO_TRANSFER_DMA_MAP transfer_flags, so that the USB core does not
do dma_map_single()/dma_unmap_single() on those buffers.

This is similar to 882787ff8fdeb0be790547ee9b22b281095e95da for the
gspca driver, and has already been discussed on the linux-media list
in the past:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg37086.html.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx231xx/cx231xx-audio.c
drivers/media/video/cx231xx/cx231xx-core.c
drivers/media/video/cx231xx/cx231xx-vbi.c

index e5742a0e19a0d1295803e970a5c31ca72ece4f9f..a2c2b7d343ec6c05d7bee2f1e1015c9a25a649f6 100644 (file)
@@ -307,7 +307,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
                urb->context = dev;
                urb->pipe = usb_rcvisocpipe(dev->udev,
                                                dev->adev.end_point_addr);
-               urb->transfer_flags = URB_ISO_ASAP;
+               urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
                urb->transfer_buffer = dev->adev.transfer_buffer[i];
                urb->interval = 1;
                urb->complete = cx231xx_audio_isocirq;
@@ -368,7 +368,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
                urb->context = dev;
                urb->pipe = usb_rcvbulkpipe(dev->udev,
                                                dev->adev.end_point_addr);
-               urb->transfer_flags = 0;
+               urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
                urb->transfer_buffer = dev->adev.transfer_buffer[i];
                urb->complete = cx231xx_audio_bulkirq;
                urb->transfer_buffer_length = sb_size;
index 39e9878cb38f14151bff28c17994a7df2e248a94..08dd930f882a60bf566774480f2bb7950f8df4a6 100644 (file)
@@ -1074,7 +1074,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
                                 sb_size, cx231xx_isoc_irq_callback, dma_q, 1);
 
                urb->number_of_packets = max_packets;
-               urb->transfer_flags = URB_ISO_ASAP;
+               urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
 
                k = 0;
                for (j = 0; j < max_packets; j++) {
@@ -1185,7 +1185,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
                        return -ENOMEM;
                }
                dev->video_mode.bulk_ctl.urb[i] = urb;
-               urb->transfer_flags = 0;
+               urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
 
                dev->video_mode.bulk_ctl.transfer_buffer[i] =
                    usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL,
index 9c5967e1d0c6bcb893e74c0a32588f78a8d03821..8cdee5f78f131a516918cb9525e0ab23fa31b0f8 100644 (file)
@@ -452,7 +452,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
                        return -ENOMEM;
                }
                dev->vbi_mode.bulk_ctl.urb[i] = urb;
-               urb->transfer_flags = 0;
+               urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
 
                dev->vbi_mode.bulk_ctl.transfer_buffer[i] =
                    kzalloc(sb_size, GFP_KERNEL);