Commit 093067ed authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Mauro Carvalho Chehab

media: videobuf2: check ->synced flag in prepare() and finish()

This simplifies the code a tiny bit and let's us to avoid
unneeded ->prepare()/->finish() calls.
Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent dcf3bfe7
...@@ -304,6 +304,9 @@ static void __vb2_buf_mem_prepare(struct vb2_buffer *vb) ...@@ -304,6 +304,9 @@ static void __vb2_buf_mem_prepare(struct vb2_buffer *vb)
{ {
unsigned int plane; unsigned int plane;
if (vb->synced)
return;
if (vb->need_cache_sync_on_prepare) { if (vb->need_cache_sync_on_prepare) {
for (plane = 0; plane < vb->num_planes; ++plane) for (plane = 0; plane < vb->num_planes; ++plane)
call_void_memop(vb, prepare, call_void_memop(vb, prepare,
...@@ -320,6 +323,9 @@ static void __vb2_buf_mem_finish(struct vb2_buffer *vb) ...@@ -320,6 +323,9 @@ static void __vb2_buf_mem_finish(struct vb2_buffer *vb)
{ {
unsigned int plane; unsigned int plane;
if (!vb->synced)
return;
if (vb->need_cache_sync_on_finish) { if (vb->need_cache_sync_on_finish) {
for (plane = 0; plane < vb->num_planes; ++plane) for (plane = 0; plane < vb->num_planes; ++plane)
call_void_memop(vb, finish, call_void_memop(vb, finish,
...@@ -1999,8 +2005,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q) ...@@ -1999,8 +2005,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
call_void_vb_qop(vb, buf_request_complete, vb); call_void_vb_qop(vb, buf_request_complete, vb);
} }
if (vb->synced) __vb2_buf_mem_finish(vb);
__vb2_buf_mem_finish(vb);
if (vb->prepared) { if (vb->prepared) {
call_void_vb_qop(vb, buf_finish, vb); call_void_vb_qop(vb, buf_finish, vb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment