Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp249190rdg; Thu, 12 Oct 2023 04:51:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTdC7p/iIwgv5L5JMQgPPqsjHp4j+slljOX3q7jK7o2R8ttxNGaCYnYbGNW97gUI70OmGX X-Received: by 2002:a05:6a20:7d94:b0:16b:e2e5:fe5e with SMTP id v20-20020a056a207d9400b0016be2e5fe5emr19993208pzj.31.1697111481154; Thu, 12 Oct 2023 04:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111481; cv=none; d=google.com; s=arc-20160816; b=EyHzTmVNLuaGuoTOWhFc5MUKAmfQc5hTxMrjyxqZee7DNCOau+knyjc1mUbs3INk0+ 5tHZfbrltEs9Tm3aAGhDRqGjHbS8HLrvYFeyLmvymCWtKZG9i4YmLpXgG17kTPvtbttQ Qdxd6qiV0noD5xSTksEvMWTyxuG7S48LWQP903MDgcwVl4ZqUcJ6Q8Fd3cV97CHXGwrK 5JvLdOdvbvyooHc0pB3KEw5IGP9iW6fxI26vh9/3oYwjHiwyRhJrra6rx+/EKm6qk3Gm NC/etocnlkdALTwlGXY9MXk7a+3lErFLbRV3NRt4Q5OcLLNJ/rh8k9eN0YZLSW+sl+1n 4ooA== 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=880OYilSR3s/ka6XPIa3CAbS09woXqMQeX/b/wUiKAQ=; fh=p0AH8hgimiy85Lh1cXLIqpi5zFbeLa4s8fsQNMmUBzM=; b=oB04VUupAB2wb1GUwbHIIKKr1HcYoId8UV6tIZSETX6HTtiAmOHigNLxDpAD0oX9JN Xcyf7eHy24cThMp0Pq/pFgWzYKoeJbNLAVVwqs5PQeHRfgmvngh0VVI/vzmrA9ZmXVXz HQHAgwIsBPQTN1eyiCMkomffOEYMidPCTaf/9vaeU98AryuPrnWkwQlxyFuh+jJpnVr5 aTakkDdfsjCOEjo/t9zf7veLrnoUSDrBmcKnNFmPax1mzkaU+gpOstYh07S3C6XOXOoG PwrC3BLJZgfdTqu16vtY9nQx8yJ+powSYOB5hhBMQ3YEW5z1MARAQ09zBS0CR1XGnXA0 rH0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Gf62AcjP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id g129-20020a636b87000000b0056534e3aeeasi2042086pgc.474.2023.10.12.04.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:51:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Gf62AcjP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 02745808BCB6; Thu, 12 Oct 2023 04:50:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378706AbjJLLtF (ORCPT + 99 others); Thu, 12 Oct 2023 07:49:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378811AbjJLLrT (ORCPT ); Thu, 12 Oct 2023 07:47:19 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C28519E; Thu, 12 Oct 2023 04:47:09 -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 04BCE660738E; Thu, 12 Oct 2023 12:47:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111228; bh=Zne8+1+gt7T5bArgwI34aDgBwx9md9yjRlThQEon5Pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gf62AcjPOWvhMdRnJLmE7bGshcMQ4KNh+hthHIVDXid8l3MkgBetP/26Xjn2KSMtb H8EIQSwmX8n+aIhWpFXtdiS3F+VD8K0qfKNtKDWURVfH22H2dLYAxvb+SWUBXxslQB 7fhI0AoGLYmOPsk2AfDcf2O9hPNloqPwd89JElrVskjwHUhCpOGFyyeJdn6VboNJhP Ac99fN6a8lkBmEnmkgSvKIVnNUyJSXkvto5CExml7BtvuC4Nx1w5XdmzPPb7C8Qi3b 342KiEz+CMwVHJEKp5FmaLjASvSoTU+TKexyrkuS7nQqQLVOR5ZPbF8Gs3IfcZmZDz wauoulmDnt5fw== 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 , Antti Palosaari Subject: [PATCH v11 35/56] media: usb: hackrf: Set min_buffers_needed to 8 Date: Thu, 12 Oct 2023 13:46:21 +0200 Message-Id: <20231012114642.19040-36-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=-0.8 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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 04:50:23 -0700 (PDT) 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 CC: Antti Palosaari --- 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; -- 2.39.2