From patchwork Wed Sep 27 15:35:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 145630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2955295vqu; Wed, 27 Sep 2023 16:11:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEimIcmLYkT+tlxSwYrduZiuGwPuL7gOfIF/lxV9UV8Zg82E9/QtVWMbN/KrXm3OOmAC2L X-Received: by 2002:a81:8246:0:b0:589:f41c:bc63 with SMTP id s67-20020a818246000000b00589f41cbc63mr4053337ywf.39.1695856273739; Wed, 27 Sep 2023 16:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695856273; cv=none; d=google.com; s=arc-20160816; b=FUzUco+Eok/D8HbpSfFg4H4ka/NxefCGaZPDJaocYNAyTo2iJpEIG7E5P8I2kIiQqf E3baxNqz3koF23Sy3EQo5an2k0B5Ff9Bw0B2EBRjJeJKrI1CjMLZK32HUZJ2HXhv9MdN JbUowfBM/Mn+3si/yzCg632vxFVNnDWoGbUKP+wfxMfqE0moSeYLajis97SviKlHcfrd SMybP8Vw4UXQNrtnPSqApG9OY/QHqxwfdzQEDP2LBmOupULnXUs5nhNRV85vVJiaCxU2 ED5cLXODr1KwjMjid8DDp0z1OBQa3UtDMQJ6/4TgkGRSXN+vVbTKWqQ8Annq8okc8+Xa 3oig== 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=4u0tbnVEtzf7uFUy5O5GUVi6lUPIj12M/GhbBAenuws=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=pNesjhF3RzIQ0bGo+yqeBOkdQjg3S7Ze+NOVugQcs4ULxpIsoCncRVKCo4uMhpFZkA 180L0w+WjE4bEefOig8CndVwMuMMKJ08o4PdNxBQjPLVZtyKoIoPzIKgCKiQUiwBTGV8 rU5e1tcHgtZvxjTVh0WvJzjjy/dJDnQJd/8vM6podDu1MeQEDqOvrz0JD49JQ3Y9j+zc vi1BvD/Xm78mNK1XTMzhXUL7XmKAoeNqFOI4AVpAlKtou+lo4hCXFJ3rdHbmC+7mnEe6 vI9iVUDVI9LsJZJzB3jZoJTZcJjQCHUAPjEfh68EYxNulFhBO/l0lfnnOZL+/uvLAoTH HZxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DnKeeyUe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id l11-20020a65560b000000b0057755b2f032si16671077pgs.542.2023.09.27.16.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 16:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DnKeeyUe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 70FD2812E358; Wed, 27 Sep 2023 08:39:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232890AbjI0Phd (ORCPT + 19 others); Wed, 27 Sep 2023 11:37:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232618AbjI0Pg1 (ORCPT ); Wed, 27 Sep 2023 11:36:27 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D05C1CC0; Wed, 27 Sep 2023 08:36:19 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:672:46bd:3ec7:6cdf]) (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 5875B6607352; Wed, 27 Sep 2023 16:36:18 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695828978; bh=rkThknrqAdahL7+ESWJTTDJdizQjBtgRoFGagWtq+LE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnKeeyUe2dD+FuHAZqX29h52sOHknpk95AAm30mGS5vC9ZvubNPU9yWIY2li0X4+p WpwwRmNnQyUu4soZMxzfdiIXGf6XCv9slZ6Q7CL2tTvuTtyB/usrbo727gSJ+pytK1 59eHdaKJ7AqXdFuT+QLEUNghJECOU3926PKvW2rb6vuTJRZX+k9yw+A7epCx9hHwez iT/B7SvF6amthuUul1WIyd3/Lch2V4tKVNeADlVE/SEYw7DIgXke9peatrmpbMC6xS Wl3kRTpZFSyIZG1Hg9+X2vBwWJTotN5KDHg1ZlJWagjaxdIIk1QaAocQ9I4PSqGqZv wJdP9WxkwGvfA== 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 Subject: [PATCH v8 23/53] media: dvb-frontends: rtl2832_srd: Use queue min_buffers_needed field Date: Wed, 27 Sep 2023 17:35:28 +0200 Message-Id: <20230927153558.159278-24-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927153558.159278-1-benjamin.gaignard@collabora.com> References: <20230927153558.159278-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:39:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778234188109489351 X-GMAIL-MSGID: 1778234188109489351 queue_setup checks for a minimum number of buffers so use queue min_buffers_needed field and remove the check done in rtl2832_sdr_queue_setup(). Signed-off-by: Benjamin Gaignard --- drivers/media/dvb-frontends/rtl2832_sdr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index 02c619e51641..597b1548ed8b 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c @@ -440,14 +440,9 @@ static int rtl2832_sdr_queue_setup(struct vb2_queue *vq, struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vq); struct platform_device *pdev = dev->pdev; - dev_dbg(&pdev->dev, "nbuffers=%d\n", *nbuffers); - - /* Need at least 8 buffers */ - if (vq->num_buffers + *nbuffers < 8) - *nbuffers = 8 - vq->num_buffers; *nplanes = 1; sizes[0] = PAGE_ALIGN(dev->buffersize); - dev_dbg(&pdev->dev, "nbuffers=%d sizes[0]=%d\n", *nbuffers, sizes[0]); + dev_dbg(&pdev->dev, "nbuffers=%d sizes[0]=%d\n", vb2_get_num_buffers(vq), sizes[0]); return 0; } @@ -1364,6 +1359,8 @@ static int rtl2832_sdr_probe(struct platform_device *pdev) dev->vb_queue.ops = &rtl2832_sdr_vb2_ops; dev->vb_queue.mem_ops = &vb2_vmalloc_memops; dev->vb_queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; + /* Need at least 8 buffers */ + dev->vb_queue.min_buffers_needed = 8; ret = vb2_queue_init(&dev->vb_queue); if (ret) { dev_err(&pdev->dev, "Could not initialize vb2 queue\n");