From patchwork Tue Mar 6 17:46:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10262343 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 7BD936016D for ; Tue, 6 Mar 2018 17:46:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CFB128AB9 for ; Tue, 6 Mar 2018 17:46:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61A8429045; Tue, 6 Mar 2018 17:46:46 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 067AB28AB9 for ; Tue, 6 Mar 2018 17:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932930AbeCFRqo (ORCPT ); Tue, 6 Mar 2018 12:46:44 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35888 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932660AbeCFRqm (ORCPT ); Tue, 6 Mar 2018 12:46:42 -0500 Received: by mail-wr0-f194.google.com with SMTP id v111so21817957wrb.3 for ; Tue, 06 Mar 2018 09:46:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=fP7zmI6GgKZXKzfzpERIpRFIXGcNaUx5rUYXHPKmM5Y=; b=O7mCIGZ4RNdM81urj/5GrE1Nqe4ka7dZ895KRC2Eq6aipjvcPJFE99hsxS+NSsEKRl WKwt/xOj+uCabFq2WMrdwUGOgoBSuAAU2u16dnVFLQ07Onr8QBmLV6UF6ZXTyD3JSAPj 6OROHXnuocrDQnTa+AHbD+4BIm7c46Y2Tw3vpW/j6DJwmkr0xnvJS0t+eQ50bkjiVCFq DB1UmSKwGyP4nWdt9lRhfglZ4jyJ8hIoQ4hIOw6NrviHOf7QtrgOcNLdqM0kiLEhhb6o hw8A+fJF6+AfaE4Iyz4cMlyql/pBE04OOfqP+PTOs6Ob0zHy4vDQZCPaLwfK5h2OoIbH RIVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=fP7zmI6GgKZXKzfzpERIpRFIXGcNaUx5rUYXHPKmM5Y=; b=c72I6hcXTpac0Q3mitmxqFQOBnZSnpj+zJ3wmD4ZtpHE0HxREjTQEVs0FQPfxR+5Zu qRvawM0rI6iePuqSxqH7I90C1Y17EVzCJSkCvfsMjgtfRjLkDeY99yjAQwwvzYL7hi2z pS55sZDpu26OY+Fdn8SJZsNX7oIfanVdzCCOagpB6XZjqm3vcWWbAbcG/SNGoRDMIc0w zJ/aTkz7NAYZRCqRHX+Tm/dXTlr0QcRJMui2vlxnKC4TMAUj+8aqKwtq+KfqtweTUSZq Zw5z8UgkPns4GUIinTmF8ArQpoUNVADIb80pdYc3+XsVm5hoWOdmDBmW+HWOHpayuppP BZUg== X-Gm-Message-State: APf1xPCSo/m5+rXNCwFxRJFd+hP4EV+nrjZN0ABmZBzjuF2LCK9eyhE2 SnvR5R5Q3IiumLBd4D7H3moA5w== X-Google-Smtp-Source: AG47ELtXNx5pVSlhKLOR0H0Nme/7w7O/WWVVzg/Noq2zGBqinfLjNNCXjRCW/kFEE4rRkvAJMyVNNQ== X-Received: by 10.223.161.211 with SMTP id v19mr17436125wrv.184.1520358400677; Tue, 06 Mar 2018 09:46:40 -0800 (PST) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id c78sm9809385wmd.45.2018.03.06.09.46.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 09:46:40 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 1/2] [media] ngene: move the tsin_exchange() stripcopy block into a function Date: Tue, 6 Mar 2018 18:46:36 +0100 Message-Id: <20180306174637.24618-2-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180306174637.24618-1-d.scheller.oss@gmail.com> References: <20180306174637.24618-1-d.scheller.oss@gmail.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 From: Daniel Scheller Move the copy logic that will skip previously inserted TS NULL frames when moving data to the DVB ring buffers into an own function. This is done to not duplicate code all over the place with the following TS offset shift fixup patch. While we're touching this part of the code, get rid of the DEBUG_CI_XFER debug-ifdeffery. This could be toggleable either by a Kconfig or a module param, but in the end this will accidentally be enabled and cause lots of kernel log messages, and such devel debug shouldn't be there anyway. Signed-off-by: Daniel Scheller --- Changed since https://www.spinics.net/lists/linux-media/msg129616.html: * DEBUG_CI_XFER ifdeffery removed drivers/media/pci/ngene/ngene-dvb.c | 39 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/drivers/media/pci/ngene/ngene-dvb.c b/drivers/media/pci/ngene/ngene-dvb.c index 65c79f1b36f7..93a07a370cfd 100644 --- a/drivers/media/pci/ngene/ngene-dvb.c +++ b/drivers/media/pci/ngene/ngene-dvb.c @@ -139,12 +139,15 @@ static void swap_buffer(u32 *p, u32 len) /* start of filler packet */ static u8 fill_ts[] = { 0x47, 0x1f, 0xff, 0x10, TS_FILLER }; -/* #define DEBUG_CI_XFER */ -#ifdef DEBUG_CI_XFER -static u32 ok; -static u32 overflow; -static u32 stripped; -#endif +static inline void tsin_copy_stripped(struct ngene *dev, void *buf) +{ + if (memcmp(buf, fill_ts, sizeof(fill_ts)) != 0) { + if (dvb_ringbuffer_free(&dev->tsin_rbuf) >= 188) { + dvb_ringbuffer_write(&dev->tsin_rbuf, buf, 188); + wake_up(&dev->tsin_rbuf.queue); + } + } +} void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) { @@ -157,28 +160,8 @@ void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) if (dev->ci.en && chan->number == 2) { while (len >= 188) { - if (memcmp(buf, fill_ts, sizeof fill_ts) != 0) { - if (dvb_ringbuffer_free(&dev->tsin_rbuf) >= 188) { - dvb_ringbuffer_write(&dev->tsin_rbuf, buf, 188); - wake_up(&dev->tsin_rbuf.queue); -#ifdef DEBUG_CI_XFER - ok++; -#endif - } -#ifdef DEBUG_CI_XFER - else - overflow++; -#endif - } -#ifdef DEBUG_CI_XFER - else - stripped++; - - if (ok % 100 == 0 && overflow) - dev_warn(&dev->pci_dev->dev, - "%s: ok %u overflow %u dropped %u\n", - __func__, ok, overflow, stripped); -#endif + tsin_copy_stripped(dev, buf); + buf += 188; len -= 188; }