From patchwork Fri Jun 15 19:07:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 10467381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E188560348 for ; Fri, 15 Jun 2018 19:07:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D34591FF2D for ; Fri, 15 Jun 2018 19:07:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7E8128E42; Fri, 15 Jun 2018 19:07:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73CF81FF2D for ; Fri, 15 Jun 2018 19:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936362AbeFOTH4 (ORCPT ); Fri, 15 Jun 2018 15:07:56 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:35864 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934701AbeFOTHz (ORCPT ); Fri, 15 Jun 2018 15:07:55 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 2F673288E58 From: Ezequiel Garcia To: linux-media@vger.kernel.org Cc: Hans Verkuil , kernel@collabora.com, Ezequiel Garcia Subject: [PATCH v4 03/17] omap4iss: Add vb2_queue lock Date: Fri, 15 Jun 2018 16:07:23 -0300 Message-Id: <20180615190737.24139-4-ezequiel@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615190737.24139-1-ezequiel@collabora.com> References: <20180615190737.24139-1-ezequiel@collabora.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP vb2_queue lock is now mandatory. Add it, remove driver ad-hoc locks, and implement wait_{prepare, finish}. Signed-off-by: Ezequiel Garcia --- drivers/staging/media/omap4iss/iss_video.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index a3a83424a926..d919bae83828 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -873,8 +873,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) if (type != video->type) return -EINVAL; - mutex_lock(&video->stream_lock); - /* * Start streaming on the pipeline. No link touching an entity in the * pipeline can be activated or deactivated once streaming is started. @@ -978,8 +976,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) media_graph_walk_cleanup(&graph); - mutex_unlock(&video->stream_lock); - return 0; err_omap4iss_set_stream: @@ -996,8 +992,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) err_graph_walk_init: media_entity_enum_cleanup(&pipe->ent_enum); - mutex_unlock(&video->stream_lock); - return ret; } @@ -1013,10 +1007,8 @@ iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) if (type != video->type) return -EINVAL; - mutex_lock(&video->stream_lock); - if (!vb2_is_streaming(&vfh->queue)) - goto done; + return 0; /* Update the pipeline state. */ if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -1041,8 +1033,6 @@ iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) video->iss->pdata->set_constraints(video->iss, false); media_pipeline_stop(&video->video.entity); -done: - mutex_unlock(&video->stream_lock); return 0; } @@ -1137,6 +1127,7 @@ static int iss_video_open(struct file *file) q->buf_struct_size = sizeof(struct iss_buffer); q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->dev = video->iss->dev; + q->lock = &video->stream_lock; ret = vb2_queue_init(q); if (ret) {