]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: staging: rkisp1: cap: protect access to buf with the spin lock
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tue, 22 Sep 2020 11:34:02 +0000 (13:34 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 27 Sep 2020 09:39:09 +0000 (11:39 +0200)
The function 'rkisp1_stream_start' calls 'rkisp1_set_next_buf'
which access the buffers, so the call should be protected by
taking the cap->buf.lock.
After this patch, all locks are reviewed and commented so remove
the TODO item "review and comment every lock"

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/rkisp1/TODO
drivers/staging/media/rkisp1/rkisp1-capture.c

index 9de4e44225e6a77df81a3914e00aa0e1eccd7ccc..e7c8398fc2cef672f064aec3884c98d8cc935851 100644 (file)
@@ -1,6 +1,5 @@
 * Fix pad format size for statistics and parameters entities.
 * Fix checkpatch errors.
-* Review and comment every lock
 * Add uapi docs. Remember to add documentation of how quantization is handled.
 * streaming paths (mainpath and selfpath) check if the other path is streaming
 in several places of the code, review this, specially that it doesn't seem it
index 4000f6c03d7eccb062dd2bbe7acba2c9594027e9..b6f497ce3e95c32fd75cf34bd9c4a391de7f3070 100644 (file)
@@ -955,6 +955,7 @@ static void rkisp1_stream_start(struct rkisp1_capture *cap)
        cap->ops->config(cap);
 
        /* Setup a buffer for the next frame */
+       spin_lock_irq(&cap->buf.lock);
        rkisp1_set_next_buf(cap);
        cap->ops->enable(cap);
        /* It's safe to config ACTIVE and SHADOW regs for the
@@ -972,6 +973,7 @@ static void rkisp1_stream_start(struct rkisp1_capture *cap)
                             RKISP1_CIF_MI_INIT_SOFT_UPD, RKISP1_CIF_MI_INIT);
                rkisp1_set_next_buf(cap);
        }
+       spin_unlock_irq(&cap->buf.lock);
        cap->is_streaming = true;
 }