From patchwork Mon Feb 23 15:06:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 5865881 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 66528BF440 for ; Mon, 23 Feb 2015 15:08:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A37722060D for ; Mon, 23 Feb 2015 15:07:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F284F2062D for ; Mon, 23 Feb 2015 15:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478AbbBWPHL (ORCPT ); Mon, 23 Feb 2015 10:07:11 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:62890 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752160AbbBWPHK (ORCPT ); Mon, 23 Feb 2015 10:07:10 -0500 Received: by mail-wi0-f172.google.com with SMTP id l15so18030217wiw.5; Mon, 23 Feb 2015 07:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=DBmYLSmc4f0+dD+ghl7cBz+46xSIsO/yh5w5g5SV1tw=; b=D8jo9YWSR1wOJfhPnt/PXwWacKGW9VhuQBDgcViSBruDAq6Yvc7jzTvz3wrJ2XEYAX 0CArGv++SK28SMkr5hKDDlxaGwavKSSBrucB6BbwURu1mwbljXJ9xuFU8V598bv3Rxsq FeJFSqmmFIUC1zX8W8DG/WyWepSEVX1/yz0mr5lw+uDezfqdr5ZYqsHamAStZ8V0t9ff 7Us4xNeROk8HpF38Z/by53OLQlBOxEq+7i4cuBVwPKgZJRNa+0Q16O8ITcVHix10avcl wPmavziNhIs6+LABz3ey9DwBDzlw7ZSjj5j9EsOGKDuQFapLkTlE+XPIVmy91CvnJXWP 5YVQ== X-Received: by 10.181.13.14 with SMTP id eu14mr21398174wid.2.1424704029138; Mon, 23 Feb 2015 07:07:09 -0800 (PST) Received: from tango-charlie.RL.local ([194.72.83.162]) by mx.google.com with ESMTPSA id fa3sm16240698wib.17.2015.02.23.07.07.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Feb 2015 07:07:08 -0800 (PST) From: Lad Prabhakar To: Hans Verkuil , Shuah Khan , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , "Lad, Prabhakar" Subject: [PATCH] media: au0828: drop vbi_buffer_filled() and re-use buffer_filled() Date: Mon, 23 Feb 2015 15:06:52 +0000 Message-Id: <1424704012-15993-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.9.1 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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: "Lad, Prabhakar" The vbi_buffer_filled() and buffer_filled() did the same functionality except for incrementing the buffer sequence, this patch drops the vbi_buffer_filled() and re-uses buffer_filled() for vbi buffers aswell by adding the check for vb2-queue type while incrementing the sequence numbers. Along side this patch aligns the code. Signed-off-by: Lad, Prabhakar Acked-by: Shuah Khan --- drivers/media/usb/au0828/au0828-video.c | 36 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index a27cb5f..60012ec 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -299,29 +299,23 @@ static int au0828_init_isoc(struct au0828_dev *dev, int max_packets, * Announces that a buffer were filled and request the next */ static inline void buffer_filled(struct au0828_dev *dev, - struct au0828_dmaqueue *dma_q, - struct au0828_buffer *buf) + struct au0828_dmaqueue *dma_q, + struct au0828_buffer *buf) { - /* Advice that buffer was filled */ - au0828_isocdbg("[%p/%d] wakeup\n", buf, buf->top_field); - - buf->vb.v4l2_buf.sequence = dev->frame_count++; - buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; - v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); - vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); -} + struct vb2_buffer vb = buf->vb; + struct vb2_queue *q = vb.vb2_queue; -static inline void vbi_buffer_filled(struct au0828_dev *dev, - struct au0828_dmaqueue *dma_q, - struct au0828_buffer *buf) -{ /* Advice that buffer was filled */ au0828_isocdbg("[%p/%d] wakeup\n", buf, buf->top_field); - buf->vb.v4l2_buf.sequence = dev->vbi_frame_count++; - buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; - v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); - vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); + if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + vb.v4l2_buf.sequence = dev->frame_count++; + else + vb.v4l2_buf.sequence = dev->vbi_frame_count++; + + vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; + v4l2_get_timestamp(&vb.v4l2_buf.timestamp); + vb2_buffer_done(&vb, VB2_BUF_STATE_DONE); } /* @@ -574,9 +568,7 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) if (fbyte & 0x40) { /* VBI */ if (vbi_buf != NULL) - vbi_buffer_filled(dev, - vbi_dma_q, - vbi_buf); + buffer_filled(dev, vbi_dma_q, vbi_buf); vbi_get_next_buf(vbi_dma_q, &vbi_buf); if (vbi_buf == NULL) vbioutp = NULL; @@ -949,7 +941,7 @@ static void au0828_vbi_buffer_timeout(unsigned long data) if (buf != NULL) { vbi_data = vb2_plane_vaddr(&buf->vb, 0); memset(vbi_data, 0x00, buf->length); - vbi_buffer_filled(dev, dma_q, buf); + buffer_filled(dev, dma_q, buf); } vbi_get_next_buf(dma_q, &buf);