media: v4l2buf: fix videobuf ext_lock locked

Fixed the videobuf ext_lock locked result no buffer used.

Change-Id: I25384fb79200bd3a9b1e604fd634d7f067168d1c
Signed-off-by: Peng Zhou <benjo.zhou@rock-chips.com>
This commit is contained in:
Peng Zhou
2017-12-14 18:37:34 +08:00
committed by Tao Huang
parent f121419cf8
commit 3592b98ce3

View File

@@ -633,6 +633,7 @@ EXPORT_SYMBOL_GPL(videobuf_qbuf);
static int stream_next_buffer_check_queue(struct videobuf_queue *q, int noblock)
{
int retval;
bool is_ext_locked;
checks:
if (!q->streaming) {
@@ -651,6 +652,16 @@ checks:
/* Drop lock to avoid deadlock with qbuf */
videobuf_queue_unlock(q);
/*ddl@rock-chips.com */
is_ext_locked = q->ext_lock &&
mutex_is_locked(q->ext_lock);
/*
* Release vdev lock to prevent this wait from blocking
* outside access to the device.
*/
if (is_ext_locked)
mutex_unlock(q->ext_lock);
/* Checking list_empty and streaming is safe without
* locks because we goto checks to validate while
@@ -658,7 +669,9 @@ checks:
retval = wait_event_interruptible(q->wait,
!list_empty(&q->stream) || !q->streaming);
videobuf_queue_lock(q);
/*ddl@rock-chips.com */
if (is_ext_locked)
mutex_lock(q->ext_lock);
if (retval)
goto done;