From patchwork Tue Feb 25 12:52:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 3716611 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8A919BF13A for ; Tue, 25 Feb 2014 12:53:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A89C3201E4 for ; Tue, 25 Feb 2014 12:53:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B753A201D3 for ; Tue, 25 Feb 2014 12:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752616AbaBYMxZ (ORCPT ); Tue, 25 Feb 2014 07:53:25 -0500 Received: from smtp-vbr13.xs4all.nl ([194.109.24.33]:2676 "EHLO smtp-vbr13.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752490AbaBYMxW (ORCPT ); Tue, 25 Feb 2014 07:53:22 -0500 Received: from tschai.lan (209.80-203-20.nextgentel.com [80.203.20.209]) (authenticated bits=0) by smtp-vbr13.xs4all.nl (8.13.8/8.13.8) with ESMTP id s1PCr9xu060127; Tue, 25 Feb 2014 13:53:11 +0100 (CET) (envelope-from hverkuil@xs4all.nl) Received: from test-media.192.168.1.1 (test [192.168.1.27]) by tschai.lan (Postfix) with ESMTPSA id 9CD352A0B18; Tue, 25 Feb 2014 13:52:57 +0100 (CET) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: pawel@osciak.com, s.nawrocki@samsung.com, m.szyprowski@samsung.com, Hans Verkuil Subject: [REVIEWv2 PATCH 09/15] vb2: rename queued_count to owned_by_drv_count Date: Tue, 25 Feb 2014 13:52:49 +0100 Message-Id: <1393332775-44067-10-git-send-email-hverkuil@xs4all.nl> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1393332775-44067-1-git-send-email-hverkuil@xs4all.nl> References: <1393332775-44067-1-git-send-email-hverkuil@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil 'queued_count' is a bit vague since it is not clear to which queue it refers to: the vb2 internal list of buffers or the driver-owned list of buffers. Rename to make it explicit. Signed-off-by: Hans Verkuil Acked-by: Pawel Osciak Acked-by: Laurent Pinchart --- drivers/media/v4l2-core/videobuf2-core.c | 10 +++++----- include/media/videobuf2-core.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index eefcff7..2a7815c 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1071,7 +1071,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) spin_lock_irqsave(&q->done_lock, flags); vb->state = state; list_add_tail(&vb->done_entry, &q->done_list); - atomic_dec(&q->queued_count); + atomic_dec(&q->owned_by_drv_count); spin_unlock_irqrestore(&q->done_lock, flags); /* Inform any processes that may be waiting for buffers */ @@ -1402,7 +1402,7 @@ static void __enqueue_in_driver(struct vb2_buffer *vb) unsigned int plane; vb->state = VB2_BUF_STATE_ACTIVE; - atomic_inc(&q->queued_count); + atomic_inc(&q->owned_by_drv_count); /* sync buffers */ for (plane = 0; plane < vb->num_planes; ++plane) @@ -1554,7 +1554,7 @@ static int vb2_start_streaming(struct vb2_queue *q) int ret; /* Tell the driver to start streaming */ - ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count)); + ret = call_qop(q, start_streaming, q, atomic_read(&q->owned_by_drv_count)); if (ret) fail_qop(q, start_streaming); @@ -1775,7 +1775,7 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q) } if (!q->retry_start_streaming) - wait_event(q->done_wq, !atomic_read(&q->queued_count)); + wait_event(q->done_wq, !atomic_read(&q->owned_by_drv_count)); return 0; } EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers); @@ -1907,7 +1907,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q) * has not already dequeued before initiating cancel. */ INIT_LIST_HEAD(&q->done_list); - atomic_set(&q->queued_count, 0); + atomic_set(&q->owned_by_drv_count, 0); wake_up_all(&q->done_wq); /* diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 82b7f0f..adaffed 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -353,7 +353,7 @@ struct v4l2_fh; * @bufs: videobuf buffer structures * @num_buffers: number of allocated/used buffers * @queued_list: list of buffers currently queued from userspace - * @queued_count: number of buffers owned by the driver + * @owned_by_drv_count: number of buffers owned by the driver * @done_list: list of buffers ready to be dequeued to userspace * @done_lock: lock to protect done_list list * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued @@ -385,7 +385,7 @@ struct vb2_queue { struct list_head queued_list; - atomic_t queued_count; + atomic_t owned_by_drv_count; struct list_head done_list; spinlock_t done_lock; wait_queue_head_t done_wq;