Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp247802rdg; Thu, 12 Oct 2023 04:48:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwm1xU4xARN+izxV8hex4wCXt1MsLGoxX8GE6Au26IXsOk/NAoZELoewvoexE3QE2qRHgd X-Received: by 2002:a05:6a20:1612:b0:149:9b2f:a79d with SMTP id l18-20020a056a20161200b001499b2fa79dmr26230618pzj.6.1697111300895; Thu, 12 Oct 2023 04:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111300; cv=none; d=google.com; s=arc-20160816; b=0TNU5umztEivQ/LZz/uvSZvxif9Ssz71GOIyZtLwszGEnukANn6AV1R/tvRJIfIzGO +3NQRZ5vvwui1xgICRNankNALzhunMnzKjVpmmRgfFAw31Vlh5p/CipY6l3jnEa8CGL0 WKAkEfmyn1NeaXLHxKRwNul4z83oDvEGomfwP9hJMYdYv6CTJ7YJSUfIfbHc6FR3C6z7 u5mEGCONvv1ZcAcHT8rodSMxmfvVpPh+BtzXzpgashLs9YmgJeELYmP9QRdTYU1kZ/Ra QqRhXYhb7f24CKy/TAXbxIqdYMRh0Q1F6Nq6a3zV8ttJFOP3c7viHhRUfy7FItPCSJ09 BtvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o2J7dUrEgQsuh900jy30fGQFA4/dmEnjcts9KQQ/O6Y=; fh=6G0QHlZndv6E4oxTLEO2WsSggK/WBr9zf05IDJK155Y=; b=vfEP0QrLHqHntNxl+JhZhkcu9/r2INn4SwoXNt9bgJOvGDKL//cJKZB+6Yc5TFtpQr hW1xxlKP3EYGL/iNr1NW2a4dOqU6VpWvXzxfLVAIqWWGL9CjT+lxMTsFsRF5Kf3vXo3E cbIWCxYI+dzvpIUscEYYQgKWkAoV4gJQA2P52vn+o4qst3SVq1/5yrgdWtFfPrFwe9Qi /kSpTHv8Oa4P+AEQKS2fDjzlUe13nrIHI9FdaEyNOul4hhBD8kEb8uWoneunSdZKYAZy /i6KnjvcF+TMWm0ZPK278rRXPRFTJ59s3T7+15qhzLUZXs2BtW/OJOLWIlw/2NtvMlWE DVlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=OoqCZCxG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ja2-20020a170902efc200b001c9e9a0b16dsi86010plb.168.2023.10.12.04.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:48:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=OoqCZCxG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A364D822CD4A; Thu, 12 Oct 2023 04:48:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379229AbjJLLsJ (ORCPT + 99 others); Thu, 12 Oct 2023 07:48:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378570AbjJLLrM (ORCPT ); Thu, 12 Oct 2023 07:47:12 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F37BF5; Thu, 12 Oct 2023 04:47:02 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7ae7:b86d:c19a:877e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id 159826607375; Thu, 12 Oct 2023 12:47:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111221; bh=RixrAQBOgKHoPu9fntvJtw2OX9PZEEsf/szxAuITdMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OoqCZCxGG5mYLqH7BsWI3ks9lAvuN2A0vIWLC0g+B1qchAvXw3rEGBCIl/oue4HFM cgeVXAHwqToHSGSY0lHLFv93r78jW99SwLlvH3ClkMT2sHvhEmBwlcodI7Ylun6Cr3 LQGRiWfYOqXOllevieIMsnB50EhzAmJt15tGHhNVxMNGtLujVUhM2ug8kBH7ddSq/M evTYgma4Jv4k45A5+otebtqyjeTYRKBZWqyI08NJBhqakXAN+PGbrTzSX4574y5nB2 KBX09pSZyVmoZDyHKkotwbfmzhZF/a45AL7+RNTPqL9mDKHJgKtPDHk+9qllOzQg8R YffczzznFjvUA== From: Benjamin Gaignard To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard , Andy Walls Subject: [PATCH v11 22/56] media: pci: cx18: Set correct value to min_buffers_needed field Date: Thu, 12 Oct 2023 13:46:08 +0200 Message-Id: <20231012114642.19040-23-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012114642.19040-1-benjamin.gaignard@collabora.com> References: <20231012114642.19040-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 04:48:19 -0700 (PDT) Set queue min_buffers_needed field to 3 and remove the useless check. Signed-off-by: Benjamin Gaignard CC: Andy Walls --- drivers/media/pci/cx18/cx18-streams.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c index 597472754c4c..6ed2c9fb882c 100644 --- a/drivers/media/pci/cx18/cx18-streams.c +++ b/drivers/media/pci/cx18/cx18-streams.c @@ -117,13 +117,6 @@ static int cx18_queue_setup(struct vb2_queue *vq, else szimage = cx->cxhdl.height * 720 * 2; - /* - * Let's request at least three buffers: two for the - * DMA engine and one for userspace. - */ - if (vq->num_buffers + *nbuffers < 3) - *nbuffers = 3 - vq->num_buffers; - if (*nplanes) { if (*nplanes != 1 || sizes[0] < szimage) return -EINVAL; @@ -286,7 +279,11 @@ static int cx18_stream_init(struct cx18 *cx, int type) s->vidq.ops = &cx18_vb2_qops; s->vidq.mem_ops = &vb2_vmalloc_memops; s->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - s->vidq.min_buffers_needed = 2; + /* + * Let's request at least three buffers: two for the + * DMA engine and one for userspace. + */ + s->vidq.min_buffers_needed = 3; s->vidq.gfp_flags = GFP_DMA32; s->vidq.dev = &cx->pci_dev->dev; s->vidq.lock = &cx->serialize_lock; -- 2.39.2