diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-01-07 07:52:37 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-10 19:38:59 -0500 |
commit | 7a6f6c29d264cdd2fe0eb3d923217eed5f0ad134 (patch) | |
tree | fc2044a0b5f6300cafbae08285c84e8f9bc55fee /drivers | |
parent | 15cb6af8ac1ee1291f98bae51cd46c6719e90c0f (diff) |
[media] cx231xx: use URB_NO_TRANSFER_DMA_MAP on URBs allocated with usb_alloc_urb()
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-audio.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-core.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-vbi.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index e5742a0e19a0..a2c2b7d343ec 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c | |||
@@ -307,7 +307,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
307 | urb->context = dev; | 307 | urb->context = dev; |
308 | urb->pipe = usb_rcvisocpipe(dev->udev, | 308 | urb->pipe = usb_rcvisocpipe(dev->udev, |
309 | dev->adev.end_point_addr); | 309 | dev->adev.end_point_addr); |
310 | urb->transfer_flags = URB_ISO_ASAP; | 310 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; |
311 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 311 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
312 | urb->interval = 1; | 312 | urb->interval = 1; |
313 | urb->complete = cx231xx_audio_isocirq; | 313 | urb->complete = cx231xx_audio_isocirq; |
@@ -368,7 +368,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev) | |||
368 | urb->context = dev; | 368 | urb->context = dev; |
369 | urb->pipe = usb_rcvbulkpipe(dev->udev, | 369 | urb->pipe = usb_rcvbulkpipe(dev->udev, |
370 | dev->adev.end_point_addr); | 370 | dev->adev.end_point_addr); |
371 | urb->transfer_flags = 0; | 371 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
372 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 372 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
373 | urb->complete = cx231xx_audio_bulkirq; | 373 | urb->complete = cx231xx_audio_bulkirq; |
374 | urb->transfer_buffer_length = sb_size; | 374 | urb->transfer_buffer_length = sb_size; |
diff --git a/drivers/media/video/cx231xx/cx231xx-core.c b/drivers/media/video/cx231xx/cx231xx-core.c index 39e9878cb38f..08dd930f882a 100644 --- a/drivers/media/video/cx231xx/cx231xx-core.c +++ b/drivers/media/video/cx231xx/cx231xx-core.c | |||
@@ -1074,7 +1074,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, | |||
1074 | sb_size, cx231xx_isoc_irq_callback, dma_q, 1); | 1074 | sb_size, cx231xx_isoc_irq_callback, dma_q, 1); |
1075 | 1075 | ||
1076 | urb->number_of_packets = max_packets; | 1076 | urb->number_of_packets = max_packets; |
1077 | urb->transfer_flags = URB_ISO_ASAP; | 1077 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; |
1078 | 1078 | ||
1079 | k = 0; | 1079 | k = 0; |
1080 | for (j = 0; j < max_packets; j++) { | 1080 | for (j = 0; j < max_packets; j++) { |
@@ -1185,7 +1185,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets, | |||
1185 | return -ENOMEM; | 1185 | return -ENOMEM; |
1186 | } | 1186 | } |
1187 | dev->video_mode.bulk_ctl.urb[i] = urb; | 1187 | dev->video_mode.bulk_ctl.urb[i] = urb; |
1188 | urb->transfer_flags = 0; | 1188 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
1189 | 1189 | ||
1190 | dev->video_mode.bulk_ctl.transfer_buffer[i] = | 1190 | dev->video_mode.bulk_ctl.transfer_buffer[i] = |
1191 | usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL, | 1191 | usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL, |
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c index 9c5967e1d0c6..8cdee5f78f13 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.c +++ b/drivers/media/video/cx231xx/cx231xx-vbi.c | |||
@@ -452,7 +452,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
452 | return -ENOMEM; | 452 | return -ENOMEM; |
453 | } | 453 | } |
454 | dev->vbi_mode.bulk_ctl.urb[i] = urb; | 454 | dev->vbi_mode.bulk_ctl.urb[i] = urb; |
455 | urb->transfer_flags = 0; | 455 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
456 | 456 | ||
457 | dev->vbi_mode.bulk_ctl.transfer_buffer[i] = | 457 | dev->vbi_mode.bulk_ctl.transfer_buffer[i] = |
458 | kzalloc(sb_size, GFP_KERNEL); | 458 | kzalloc(sb_size, GFP_KERNEL); |