diff options
author | Tiffany Lin <tiffany.lin@mediatek.com> | 2015-09-24 05:02:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-10-20 12:36:24 -0400 |
commit | 418dae2276065680bde7ae27d2c075e612a54de6 (patch) | |
tree | 807afdf69a7434c8f06483556a344974b5adb47e | |
parent | d9a985883fa32453d099d6293188c11d75cef1fa (diff) |
[media] media: vb2 dma-sg: Fully cache synchronise buffers in prepare and finish
In videobuf2 dma-sg memory types the prepare and finish ops, instead
of passing the number of entries in the original scatterlist as the
"nents" parameter to dma_sync_sg_for_device() and dma_sync_sg_for_cpu(),
the value returned by dma_map_sg() was used. Albeit this has been
suggested in comments of some implementations (which have since been
corrected), this is wrong.
Fixes: d790b7eda953 ("vb2-dma-sg: move dma_(un)map_sg here")
Cc: stable@vger.kernel.org # for v3.19 and up
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-dma-sg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index 34b67784a9c1..9985c89f0513 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c | |||
@@ -210,7 +210,8 @@ static void vb2_dma_sg_prepare(void *buf_priv) | |||
210 | if (buf->db_attach) | 210 | if (buf->db_attach) |
211 | return; | 211 | return; |
212 | 212 | ||
213 | dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); | 213 | dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents, |
214 | buf->dma_dir); | ||
214 | } | 215 | } |
215 | 216 | ||
216 | static void vb2_dma_sg_finish(void *buf_priv) | 217 | static void vb2_dma_sg_finish(void *buf_priv) |
@@ -222,7 +223,7 @@ static void vb2_dma_sg_finish(void *buf_priv) | |||
222 | if (buf->db_attach) | 223 | if (buf->db_attach) |
223 | return; | 224 | return; |
224 | 225 | ||
225 | dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); | 226 | dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); |
226 | } | 227 | } |
227 | 228 | ||
228 | static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr, | 229 | static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr, |