From patchwork Mon Apr 2 18:24:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10320171 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 E9B8760375 for ; Mon, 2 Apr 2018 18:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D96B328A4C for ; Mon, 2 Apr 2018 18:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDFB228A67; Mon, 2 Apr 2018 18:24: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 85AFF28A4C for ; Mon, 2 Apr 2018 18:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753662AbeDBSYo (ORCPT ); Mon, 2 Apr 2018 14:24:44 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39359 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753442AbeDBSYm (ORCPT ); Mon, 2 Apr 2018 14:24:42 -0400 Received: by mail-wm0-f68.google.com with SMTP id f125so29013074wme.4 for ; Mon, 02 Apr 2018 11:24:42 -0700 (PDT) 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=vb2CXjT+GlKfHLNBtwqs0/wki27BO5AnsHLUQfX5WBs=; b=SJBLf1VAJ5fSrqQuNj8dCqnyqGgQjyI0DgMsbyuzx7fUaCob6prP9f/YDHF7NxbnNJ KyfMyUl99Qxc3MoXesFJN8ZPmF4hjiql2VE1OxVdhgUAJUe6ondslabuSTr2xdY8RVrF Hi+5zf9kAc8bBZ1hDOmzrldmpKvPW6YWP3Sd0JjUqT5ZsEj2rTvK/MIQBgKE6yngXAuU AhsurW2ixacKCNyBwbLHyx/5gpTlc4/LiHCYB9d5XDkHIAa4vapN+wWKB1b8XGqM9JNd EI2GQd3Rt1kO86/lKXZjWL1oSnJZAjroKJ70L5wuZALCC+wF4jp0sP/4afUUD2iRFvxi uerg== 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=vb2CXjT+GlKfHLNBtwqs0/wki27BO5AnsHLUQfX5WBs=; b=kyS+5YOCUSUkQrhQnHqS7+RTg1UlAkoAcWvneUpxhQmG0OZyoig8/w2v7w/eOlJjzk mPVzMDGxCDV7eMmBDdwH/FPQG/Z/ASOrNUs56UPwvHAKkM6Mzv0ULBJLBeICTZE08B5x T+lqxRv2FJoekG/i/Dmyhx3BYoXJkFRX/x0FW3295vV2Jh9DkGRuwtZFReFtPuI3TXWZ SXRVmkXUWf6g4AloEtmgwj2x9X5UFMbjH2UWHOrTBhSzfEMu57Tb2cB1VoBL5AixSgkP k8zwGHamK1jhbOR0ON61bb7WkefSwnp7DkMALpj86flE2MdBE04OVCEEspmISexUqvoT bAMA== X-Gm-Message-State: ALQs6tCA5BInHd8hKtHj7s/khR2GPHPK4TVutjqW7l/k6kFpVe0dIWQm DdvK/KqM2kqKJ5CxGsT0rIJwHg== X-Google-Smtp-Source: AIpwx4/QBgWfqahJI1RKoik5Uvn0SEfkb4C4+7XgfwvnTZF1hcSCewpMfI627CANjxJwC/KI/Sht1Q== X-Received: by 10.28.174.79 with SMTP id x76mr1787378wme.41.1522693481336; Mon, 02 Apr 2018 11:24:41 -0700 (PDT) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id x9sm2368273wrb.18.2018.04.02.11.24.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 11:24:40 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 12/20] [media] ddbridge: fix output buffer check Date: Mon, 2 Apr 2018 20:24:19 +0200 Message-Id: <20180402182427.20918-13-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180402182427.20918-1-d.scheller.oss@gmail.com> References: <20180402182427.20918-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 A 188 byte gap has to be left between the writer and the consumer. This requires 2*188 bytes available to be able to write to the output buffers. So, change ddb_output_free() to report free bytes according to this rule. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index c22537eceee5..e9c2e3e5d64b 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -587,12 +587,12 @@ static u32 ddb_output_free(struct ddb_output *output) if (output->dma->cbuf != idx) { if ((((output->dma->cbuf + 1) % output->dma->num) == idx) && - (output->dma->size - output->dma->coff <= 188)) + (output->dma->size - output->dma->coff <= (2 * 188))) return 0; return 188; } diff = off - output->dma->coff; - if (diff <= 0 || diff > 188) + if (diff <= 0 || diff > (2 * 188)) return 188; return 0; }