From patchwork Sat Feb 24 18:55:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10240471 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 93C36602A0 for ; Sat, 24 Feb 2018 18:55:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88DB129BE3 for ; Sat, 24 Feb 2018 18:55:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DA8929BFC; Sat, 24 Feb 2018 18:55:59 +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 2614729BE3 for ; Sat, 24 Feb 2018 18:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751516AbeBXSz4 (ORCPT ); Sat, 24 Feb 2018 13:55:56 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36763 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751378AbeBXSzs (ORCPT ); Sat, 24 Feb 2018 13:55:48 -0500 Received: by mail-wr0-f194.google.com with SMTP id v111so5017618wrb.3 for ; Sat, 24 Feb 2018 10:55:48 -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=sRhgYTCl9OI7uLOfH7i4APieND86np04L6y4C+FtDF4=; b=Oh6cdAWDUDhwxjZwBMiB8sfjqpujMJgdvquZn/U7JeS0O2l2vTl5oRoxqzB++V0GwO XJIBRYPTERhlnWi8SevHi70dsG9a3vI9ztbUA3wAuG4FMTCIxHuTGey7el/e8mtmoQNd N63WfZzAnkrTJRYWHSxaDcM1k9IQTnPwJAVXslF/2TjioEwTNL7Zdwqk+vWf3YPChsBt AiNCfGGmxuAY9LW0fG+ZVgwQlQJLliMfsUHjhFj3/AP4lGIPkPYjCqB27T0YuAA/CJ84 pA1jw/MNxlIu6jQNzoUqiJv+KlR0R5ohnj3NlABZARGOdWkF6qTFw1CcuEurAvXRRqmG EefQ== 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=sRhgYTCl9OI7uLOfH7i4APieND86np04L6y4C+FtDF4=; b=O0iTTtiXPtaB9alOjs7QhuYBB+kp020KNgCnOOa0h9yq5TfZ4e3EPK/yK9AkUFECLh H4Zug5KL6czwxrs39RC343nApbD6kZMvJ7LFDg0vz0kXo6Jt8TtMrGeKmiEfU5jtM7dE o452FKZUkdf7j+RUrZ97RtdayjgqbdKPBUQ3tTB9ONeKEhY0lbDgVnRZeVxAPXfI4rXa NSK1wFKHEw8H4QSOPzXhKbA05SpqpDUuNONZRNeIgjB0oCT2myAruOjpYmI10F6idcUP qqVOj89JTDx/SJdxQs7yrzy5x6DSIaTRkxfoW8jhdJkfhrYDnouWKualgutNqc3xoEl/ PpiA== X-Gm-Message-State: APf1xPBVFZKtg9mTUiwJar87uNnXQ6O0tRipU+MWFc+E3VrsgFMvuq/z qjsZkeR70+bNFHfj5+ONdqsRYg== X-Google-Smtp-Source: AH8x2271mCVd878dCVMpJHnC2qFlCYJJNfidJbTSD7EtDlGHY67kKZB1C/HcQ4g+NQnFwHpbgvupNg== X-Received: by 10.223.190.141 with SMTP id i13mr4861721wrh.235.1519498547295; Sat, 24 Feb 2018 10:55:47 -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 3sm526270wry.29.2018.02.24.10.55.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 10:55:46 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 11/12] [media] ngene: move the tsin_exchange() stripcopy block into a function Date: Sat, 24 Feb 2018 19:55:33 +0100 Message-Id: <20180224185534.13792-12-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180224185534.13792-1-d.scheller.oss@gmail.com> References: <20180224185534.13792-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. Signed-off-by: Daniel Scheller --- drivers/media/pci/ngene/ngene-dvb.c | 48 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/media/pci/ngene/ngene-dvb.c b/drivers/media/pci/ngene/ngene-dvb.c index f71fd41c762c..6d72b9f69418 100644 --- a/drivers/media/pci/ngene/ngene-dvb.c +++ b/drivers/media/pci/ngene/ngene-dvb.c @@ -123,6 +123,32 @@ 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); +#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 +} + void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) { struct ngene_channel *chan = priv; @@ -134,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++; + tsin_copy_stripped(dev, buf); - if (ok % 100 == 0 && overflow) - dev_warn(&dev->pci_dev->dev, - "%s: ok %u overflow %u dropped %u\n", - __func__, ok, overflow, stripped); -#endif buf += 188; len -= 188; }