From patchwork Tue Feb 24 13:00:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 5872591 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 C0672BF440 for ; Tue, 24 Feb 2015 13:00:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C84B820220 for ; Tue, 24 Feb 2015 13:00:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2A14201EC for ; Tue, 24 Feb 2015 13:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752410AbbBXNAz (ORCPT ); Tue, 24 Feb 2015 08:00:55 -0500 Received: from mail-wg0-f51.google.com ([74.125.82.51]:43303 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbbBXNAy (ORCPT ); Tue, 24 Feb 2015 08:00:54 -0500 Received: by wggy19 with SMTP id y19so5093352wgg.10 for ; Tue, 24 Feb 2015 05:00:53 -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=2m1IzQuu95cYau/EH3k3aFDBIIytGQVkC4wwuqSPwQY=; b=RrfY3E55VHPOF0D65z8D+sXH0Ym3OV8SLJmMywmz2Y21rNey5hurF/QFfludN9Erh9 pUdF28Gh1bPfvLrQ+hf5Q4N1VchdQf4Bh1G+mN6uGI+citHjRjAzF1o3TVLDfy4QSPfN KMeUvH9i+szwoS8UZL0P24r7Cgozhb+hZL9WQc2D8+B2mmlEz2MXXu5KufKmo099NSzl rEJ615Cd4sZBdF8hyBYJjGyj6+9YEZEV2iJJtCwGZhUDvFgUjJ8eSYtlbod9gjTydCB8 dWmdfjPafviU9ocdt/Uvgm2euSWXWcLbXZfMftsTZxQ6e3qtQbxPah4ouV/ioL8evYrF UcHA== X-Received: by 10.180.7.196 with SMTP id l4mr29681529wia.44.1424782853664; Tue, 24 Feb 2015 05:00:53 -0800 (PST) Received: from tango-charlie.RL.local ([194.72.83.162]) by mx.google.com with ESMTPSA id hv5sm60144647wjb.16.2015.02.24.05.00.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Feb 2015 05:00:52 -0800 (PST) From: Lad Prabhakar To: Hans Verkuil , linux-media@vger.kernel.org, Shuah Khan Cc: "Lad, Prabhakar" Subject: [PATCH v2] media: au0828: drop vbi_buffer_filled() and re-use buffer_filled() Date: Tue, 24 Feb 2015 13:00:29 +0000 Message-Id: <1424782829-20907-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=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: "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 as well by adding the check for vb2-queue type while incrementing the sequence numbers. Along side this patch aligns the input parameters of buffer_filled() function appropriately. Signed-off-by: Lad, Prabhakar Acked-by: Shuah Khan --- Changes for v2: 1: fixed a typo in commit message. 2: Included a Ack from Shuah. 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);