Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ivtv: Fix PCI DMA direction

The ivtv stream buffers may be for receive or for send but the attached
sg handle is always destined cpu->device. We flush it correctly but the
allocation is wrongly done with the same type as the buffers.

See bug: http://bugzilla.kernel.org/show_bug.cgi?id=13385

(Note this doesn't close the bug - it fixes the ivtv part and in turn
the logging next shows up some rather alarming DMA sg list warnings in
libata)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alan Cox and committed by
Linus Torvalds
e9e10124 edaba2c5

+2 -1
+2 -1
drivers/media/video/ivtv/ivtv-queue.c
··· 230 230 return -ENOMEM; 231 231 } 232 232 if (ivtv_might_use_dma(s)) { 233 - s->sg_handle = pci_map_single(itv->pdev, s->sg_dma, sizeof(struct ivtv_sg_element), s->dma); 233 + s->sg_handle = pci_map_single(itv->pdev, s->sg_dma, 234 + sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE); 234 235 ivtv_stream_sync_for_cpu(s); 235 236 } 236 237