]> git.baikalelectronics.ru Git - kernel.git/commit
media: videobuf-dma-sg: Fix dma_{sync,unmap}_sg() calls
authorRobin Murphy <robin.murphy@arm.com>
Mon, 30 Apr 2018 16:56:28 +0000 (12:56 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 9 May 2018 20:25:12 +0000 (16:25 -0400)
commitb9332c7514957971b8ca970c56b1d4c635f59121
treeaed863c8a4b66d0ac32fcbe0693cd942072b99e2
parent5583135ec3b1a07f2eaf65af3af6d574dc1ec4b4
media: videobuf-dma-sg: Fix dma_{sync,unmap}_sg() calls

This reverts commit 497fab49fa7109512ae3720c2bd8c570e37d14f4.

Whilst the rationale for the above commit was in general correct, i.e.
that users *consuming* the DMA addresses should rely on sglen rather
than num_pages, it has always been the case that the DMA API itself
still requires that dma_{sync,unmap}_sg() are called with the original
number of entries as passed to dma_map_sg(), not the number of mapped
entries it returned. Thus the particular changes made in that patch
were erroneous.

At worst this might lead to data loss at the tail end of mapped buffers
on non-coherent hardware, while at best it's an example of incorrect
DMA API usage which has proven to mislead readers.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/videobuf-dma-sg.c