From patchwork Mon Apr 9 16:47:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10331761 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 7B00060236 for ; Mon, 9 Apr 2018 16:48:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CC0A28800 for ; Mon, 9 Apr 2018 16:48:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 617152880B; Mon, 9 Apr 2018 16:48:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 17A2028800 for ; Mon, 9 Apr 2018 16:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753412AbeDIQsJ (ORCPT ); Mon, 9 Apr 2018 12:48:09 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:40726 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753391AbeDIQsG (ORCPT ); Mon, 9 Apr 2018 12:48:06 -0400 Received: by mail-wr0-f193.google.com with SMTP id n2so10254286wrj.7 for ; Mon, 09 Apr 2018 09:48:06 -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=VnRr5EP27HVI/sdAeF4RXCdHSEOpcTcTN7W5pXKL5Spif1GwfkEXceCzIynBHgZ3kD xtdb8k8zP7pC4w1d00TNuVssvUVLmqYDvjWzwI0sSf8IRLbZVf+oY6n9FVWshe/wn1mG QrZqwiIKgo+s34l1yywWX2E5RiHN7PP2iU19Od49HzNbd4FYPq+cC/HBr+zBloXe6X61 TnVKZ9tLJOBeFvaz1l3usjd9WLOekoABh5xwRbUv0UW//HRmSC4wB3UtoSHhlGsrImhW e4G5vBUygcLBvfHzjl0B1ErVwY5vR3/3F7nDqAh1PALmDDZAiG2wOW+pdzfqmvxZq/eK JMWQ== 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=Mewy7W1aLfg/YgrUnzPTuLav8/hPB9zC40rp3/cLYy2q6ar+AW8ZoNm13pJ1GX47Yp eiAiDL4YnMH6WtZzDYHmJM+fg5p0FVwXiw3+keneZ33yZLzatr8ft0NKlFdQZvs4FyxC tjxq9NPzhoLMKmPac8xGJPvAe8mqVZC1n7lqkANTdCCMJcpoFIwAb7L/4+13c4xoRvLc +SbB2fqAGuSx2Pu0iun6xeOpydGoSuh18dZBtzTH/r3AhFmc8vC6fCtr6kJm8cUL3w8C gKJ598qKIbony2yvZbYuSnZXMnzZ9bUXGGcRIvqDfu1mkl0xpL5uylAo1Q1I/l2TVL4x TZSg== X-Gm-Message-State: AElRT7GGdyxnYmrRKTDzdCQ26TBitRviRvDC2WWIxK4viSY4rukb+OHb xvv+wPVJwZoUhEygmUYBxk6rtQ== X-Google-Smtp-Source: AIpwx48KYks9Km3quPcQswAnSYGb3/b0f06El16ejeo91uC74EN1pWeZZ23JwAN1pmGr13mGntQPNQ== X-Received: by 10.223.141.143 with SMTP id o15mr28407834wrb.272.1523292485462; Mon, 09 Apr 2018 09:48:05 -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 11sm1380416wmd.1.2018.04.09.09.48.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 09:48:04 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH v2 11/19] [media] ddbridge: fix output buffer check Date: Mon, 9 Apr 2018 18:47:44 +0200 Message-Id: <20180409164752.641-12-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180409164752.641-1-d.scheller.oss@gmail.com> References: <20180409164752.641-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; }