From 3592b98ce357929e3e4175a19e74080a2afeef64 Mon Sep 17 00:00:00 2001 From: Peng Zhou Date: Thu, 14 Dec 2017 18:37:34 +0800 Subject: [PATCH] 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 --- drivers/media/v4l2-core/videobuf-core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf-core.c b/drivers/media/v4l2-core/videobuf-core.c index 6c02989ee33f..51bf5252b6ec 100644 --- a/drivers/media/v4l2-core/videobuf-core.c +++ b/drivers/media/v4l2-core/videobuf-core.c @@ -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;