From patchwork Mon Jun 20 12:30:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 9187311 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 9F027607D1 for ; Mon, 20 Jun 2016 12:43:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8555026861 for ; Mon, 20 Jun 2016 12:43:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75FDB2793A; Mon, 20 Jun 2016 12:43:28 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 2127826861 for ; Mon, 20 Jun 2016 12:43:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753385AbcFTMnY (ORCPT ); Mon, 20 Jun 2016 08:43:24 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36194 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752623AbcFTMnW (ORCPT ); Mon, 20 Jun 2016 08:43:22 -0400 Received: by mail-lf0-f67.google.com with SMTP id a2so5335011lfe.3; Mon, 20 Jun 2016 05:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Bkvyvpo+cF7KyEUcatOmL4cZ3ivX7DLXlA+rpA3HtYk=; b=DhMx1tlvM/A16l2ePRyjkk08HPDwYr3aCfkpXGIBtcKA6LDJzjXPFoVPhOJEdMsMXl +3UmCbJaYXZ4WYO2W+xyIFrh9Lx+HlJGybYSh+CkOP8S2chmPpvxdFVD0B+nVDMPSAgC 3Wwnfo90/iemucCD4cSQ5MFPNLoKeyz9KvUJcaOQUGIztPaD/qFdDTmZldyyCpxpep/j 0Tf4GgaUIR1sxWXASQ8zayBm+eUj/Lzpd6ga/yuKo+SlSd6j5MsgDON8no9MwXceOWa/ Zuw7XPgAteByBQ0NirS6oU65Rnb4lhF3tGCVoP2C4X04bncxKn2amriOEhiwJOWZoJMe 3TiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Bkvyvpo+cF7KyEUcatOmL4cZ3ivX7DLXlA+rpA3HtYk=; b=UH31bEnDxozngWjFGEkuasFhCe42RQy8hCRC6iUQnG6Z+PHwyJUARnTbddvepQIor4 GMjC3Ao+6ESPF+Z8ApNU7TmyK1Dv4ObjH8H+c5X0Al8FHaGFuqDcBMe1cHylHJskRGAg 9hfleZakH2Gz4UBbfKJ8zusDbz3kU+623CO6HgKwH0/VWICY9uLxQ1wl+nJ5kWKwqiI5 UaHc4+747/nDsc5mhMdrMjmODZiMef5qkGmKwk2TXkUjI8u1GXRK9eTvKIz6eLjtot+G iMNnYErbIZBMZp6OrdNlsp4o8EQBwy7NSY2itNLxxvGy6aV0Hf+WvQUszRqgdbDreUWB J+Ew== X-Gm-Message-State: ALyK8tKXH+Ay0MoZ2TXuBcxnPTjfxxzMoqM9gu1S88roTmfd7fRafDSStu+2RA5+iAoVdg== X-Received: by 10.46.33.227 with SMTP id h96mr3971926lji.50.1466425812203; Mon, 20 Jun 2016 05:30:12 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id u193sm4921183lfd.36.2016.06.20.05.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 05:30:11 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pawel Osciak , Marek Szyprowski , Kyungmin Park , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hans.verkuil@cisco.com, hverkuil@xs4all.nl Cc: Ricardo Ribalda Delgado Subject: [PATCH v2 1/4] vb2: Merge vb2_internal_dqbuf and vb2_dqbuf Date: Mon, 20 Jun 2016 14:30:06 +0200 Message-Id: <1466425809-23469-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.8.1 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 After all the code refactoring, vb2_internal_dqbuf is only called by vb2_dqbuf. Since the function it is very simple, there is no need to have two functions. Signed-off-by: Ricardo Ribalda Delgado --- drivers/media/v4l2-core/videobuf2-v4l2.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 7f366f1b0377..07d8b409ce05 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -621,21 +621,6 @@ int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) } EXPORT_SYMBOL_GPL(vb2_qbuf); -static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, - bool nonblocking) -{ - int ret; - - if (b->type != q->type) { - dprintk(1, "invalid buffer type\n"); - return -EINVAL; - } - - ret = vb2_core_dqbuf(q, NULL, b, nonblocking); - - return ret; -} - /** * vb2_dqbuf() - Dequeue a buffer to the userspace * @q: videobuf2 queue @@ -659,11 +644,21 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, */ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) { + int ret; + if (vb2_fileio_is_active(q)) { dprintk(1, "file io in progress\n"); return -EBUSY; } - return vb2_internal_dqbuf(q, b, nonblocking); + + if (b->type != q->type) { + dprintk(1, "invalid buffer type\n"); + return -EINVAL; + } + + ret = vb2_core_dqbuf(q, NULL, b, nonblocking); + + return ret; } EXPORT_SYMBOL_GPL(vb2_dqbuf);