]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: videobuf2: check ->synced flag in prepare() and finish()
authorSergey Senozhatsky <senozhatsky@chromium.org>
Thu, 14 May 2020 16:01:48 +0000 (18:01 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 23 Jun 2020 11:37:05 +0000 (13:37 +0200)
This simplifies the code a tiny bit and let's us to avoid
unneeded ->prepare()/->finish() calls.

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/common/videobuf2/videobuf2-core.c

index b15fb11be84644603537121a3a6196029215fa29..37d0186ba3308b3cbcafd82347a73dd215e93a86 100644 (file)
@@ -304,6 +304,9 @@ static void __vb2_buf_mem_prepare(struct vb2_buffer *vb)
 {
        unsigned int plane;
 
+       if (vb->synced)
+               return;
+
        if (vb->need_cache_sync_on_prepare) {
                for (plane = 0; plane < vb->num_planes; ++plane)
                        call_void_memop(vb, prepare,
@@ -320,6 +323,9 @@ static void __vb2_buf_mem_finish(struct vb2_buffer *vb)
 {
        unsigned int plane;
 
+       if (!vb->synced)
+               return;
+
        if (vb->need_cache_sync_on_finish) {
                for (plane = 0; plane < vb->num_planes; ++plane)
                        call_void_memop(vb, finish,
@@ -1999,8 +2005,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
                                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) {
                        call_void_vb_qop(vb, buf_finish, vb);