From patchwork Wed Sep 27 15:35:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 145625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2948663vqu; Wed, 27 Sep 2023 15:59:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGP/yftJ3fmXe449IOtmjEdshbak+fjSEl4o1UOxjBSR4P3zB60J9FHaZd0pTwT+TkZiAq5 X-Received: by 2002:a17:907:271a:b0:9a5:a0c6:9e8e with SMTP id w26-20020a170907271a00b009a5a0c69e8emr2514550ejk.31.1695855579296; Wed, 27 Sep 2023 15:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695855579; cv=none; d=google.com; s=arc-20160816; b=gqAOqQBg7yJD4x/hhek1VAhe7EKHO6CbprdkypEeEUXASRK3O5kf8TH0FUqH92I597 cHx7XqNLY0JETAlspDAEn9IQEd5dVu6aJz7czSmAq+K5QKgothQG1hyMuFQ/RUPWa14t n4otokvPmGNp0KnewnBQp30KbssRx3l6TzarzAItk3+KaqBYbTl9uM/eLbTHe+LCMs3a CJ4ymyM8RkfXdkRHBhBwvhX1Y+vXadWKrK5HTF8YF8z81VK39J8J8ofw/mOQY0Yqr+5M FN7mcRMzy6sCRiqAq+bvB0ykBcFAPGMWRtc7nWxwa5mrWOxXw0V+ZK6sy8/4mvbXJq55 xhcA== 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=6Uo+DWz6nzURRzOrpiTlNauRcx9JlP212HftAuLBiRM=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=jpY7J4zamlRwtBmNg4UalhnnXKPS8D+eoUPhTSm+axjeQ8OMzCo69Jh4lPXfOYN9QY TmoaqFSaxFtGP3LGabrjXXgoTPMnAjfC4NqHo7z6qiY3Kzh/IPS1n6Xu1qSa9EDxpqhx S8pqBKAZil5oDx6712836CcBLwFKBMrzz0Ts9n70I9HAbeA5ZIoc1/j+xhoUV4egdRRQ qg/7BNReQ5z/HoPPICpEW2BgsWGmnX0w7myd+deOaepcZosg+xla78u+/drTIOv/mP2S 5LCTckHH5AwJ4ABeOaKtjsH9GXQjMOujNqlTFsnPTKAkNuZQUSJA9mHE8QmDPyxD9l3T 6P1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bxmYEwxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y3-20020a1709064b0300b009ad87ec8271si15018290eju.1.2023.09.27.15.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:59:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bxmYEwxi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 247B08098B04; Wed, 27 Sep 2023 08:38:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232712AbjI0PiL (ORCPT + 19 others); Wed, 27 Sep 2023 11:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232705AbjI0Pgd (ORCPT ); Wed, 27 Sep 2023 11:36:33 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A06CE1A7; Wed, 27 Sep 2023 08:36:28 -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 291486607370; Wed, 27 Sep 2023 16:36:27 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695828987; bh=pDUB2yjXKjklQT9CTDtddlAytBql2bguZ0k3zUQQEeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxmYEwxirHbknnbfs0TViSopXrFAjYtxpHCxqtAIqaWCIczyE1DCb+f8tQxX7MKad tRlJMLW+3BI39Bc7SgMAcanCER6jOqynm8jFyJW6KURnAiX0gynJeU9aH1B9YdWW8v VFlE+eDdobofRja/uoQg6yYQsluYH7KB1wRek0yz5Ni1dKK/VssLC4lpeSEQRz/tzn l/sjNLFR2PJCVil6e2i4399vXnvlTpOLmDAcpfBK4z2zQCCSfi2+Aw0BjT1FiUkDGy s1TdC/VPXLaG/vKv2O69K2gBBv2WEqkD1K8DDHLWSMJb2GeN6FfAtcdDA5LS4gPSAo 3vr6UADXdxEDg== 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 40/53] media: usb: hackrf: Set min_buffers_needed to 8 Date: Wed, 27 Sep 2023 17:35:45 +0200 Message-Id: <20230927153558.159278-41-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:38:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778233459915331482 X-GMAIL-MSGID: 1778233459915331482 vb2 queue_setup checks for a minimum number of buffers so set min_buffers_needed to 8 and remove the useless check in hackrf_queue_setup(). Signed-off-by: Benjamin Gaignard --- drivers/media/usb/hackrf/hackrf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 3e535be2c520..2e856b20aa21 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c @@ -754,15 +754,10 @@ static int hackrf_queue_setup(struct vb2_queue *vq, { struct hackrf_dev *dev = vb2_get_drv_priv(vq); - dev_dbg(dev->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(dev->dev, "nbuffers=%d sizes[0]=%d\n", *nbuffers, sizes[0]); + dev_dbg(dev->dev, "nbuffers=%u sizes[0]=%d\n", vb2_get_num_buffers(vq), sizes[0]); return 0; } @@ -1392,6 +1387,8 @@ static int hackrf_probe(struct usb_interface *intf, dev->rx_vb2_queue.type = V4L2_BUF_TYPE_SDR_CAPTURE; dev->rx_vb2_queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ; + /* Need at least 8 buffers */ + dev->rx_vb2_queue.min_buffers_needed = 8; dev->rx_vb2_queue.ops = &hackrf_vb2_ops; dev->rx_vb2_queue.mem_ops = &vb2_vmalloc_memops; dev->rx_vb2_queue.drv_priv = dev;