From patchwork Thu Oct 12 11:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 152004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1193494vqb; Thu, 12 Oct 2023 05:34:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNflBKtY18z7YUa9Pdq81R2HDwbUU73ti7yVup3miBY72QunnufEonLHdlkoIaktgvk/An X-Received: by 2002:a05:6a20:a123:b0:13f:65ca:52a2 with SMTP id q35-20020a056a20a12300b0013f65ca52a2mr26608727pzk.5.1697114043435; Thu, 12 Oct 2023 05:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697114043; cv=none; d=google.com; s=arc-20160816; b=hVsYbH+3NbZBibOZgYoV3TPLmYp/yYFyJLNvlTvhpj8opnXG6KcBdTTzDwsA440huT oQqYFaEJwELDz7jV7EvSW2PQrrJxTej7GPlfZRc9vpZNNkG/cFjaVWA/3Z1fpsUxWVMp 9qWANegPbXn49j0K8EzadGK5CdUCo3zAc3WxLpiOyzwwHMu5AHQsPmIcbBIjWXRZWt9H mhQDCUyVwYpdygiVmFOjb8Co2HvaWWZehdblttuZ9qTTDWQLmxToAvxBdI7HH8Nn2eyW 3Ak/X9L5xx3FS4MWkUEWQ6BagC7hkeY9oczNrjH64hfd2AlGuxTWiyiEWNS1FROF4LiP tz7w== 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=mZs75sxNyEMKxgyp24DosHVVPoQJidrdHhoLAIzZ8gc=; fh=p0AH8hgimiy85Lh1cXLIqpi5zFbeLa4s8fsQNMmUBzM=; b=nG2rN3J5arqJRilHpBTUnIbHNIfzxWoV47M0gEmEgCulVj26eiO2gUYSbddCTcMTVH ETG9J3UPOIspjVQHK1rYH7PDttK3VsFJNZuUTKd9AVDxtroSHHhhY1liFgQi5ayCTvC2 4w0Rd1GHbOjdXjgrpd4ZSguDqDCEQx+zzeybZs1reAAYaK462LGfne1CPPI3LJRzZJUn V5bRvx40QIUluzGKuo8q6AhGHFzTJqzASJfcWRjVZBE9tI8O5Gnh+wmSZohrJo4s4BCo egyEsRgHdnolkZTCuzl6e+O5SeWBhhEgQFNjxZfGs6ePA0wN1zj20DZvJ6E+eVr+dD05 KVQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=L8cYZ8LK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id d4-20020a17090ab30400b00276ea6d9ac3si2056381pjr.182.2023.10.12.05.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 05:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=L8cYZ8LK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 EB0B781AA505; Thu, 12 Oct 2023 05:34:00 -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 S1379324AbjJLLs4 (ORCPT + 19 others); Thu, 12 Oct 2023 07:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378706AbjJLLrO (ORCPT ); Thu, 12 Oct 2023 07:47:14 -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 B44FA185; Thu, 12 Oct 2023 04:47:08 -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 EC0CF660738C; Thu, 12 Oct 2023 12:47:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111227; bh=2/0WQage6iY7ZIfSwpoGdnzQlJzC1UZq8fdQbr8LRKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L8cYZ8LKwxDdQJC/fkFna0Z4loJWQY4rlLc2nv/Iu86jK57Dgo5nLbgWL6uzreecL kXVb7RHCUVlKxJXrPlrZTBFj0wjGyXvpXiK45iRJ3QADd1AjZvZTBkp4lJ47u1w2tz 8LSUo+83BEFBQ9rAZKDCL3bHB+qY/PPmhiOLoehJZIQtbLpsWqyyk8XPRxj1K1ZTbY xBeynsjCo2i/JM5xiLNWE8A8rfak1nxqGNM5ADSU/4GokgPl+JIZaITV8jQKANfJXE vR5aneBs49rxfpAOgs6fzUVB2eslLVMTPIGMR8A6GyzQlfki+NJE+lFeWQ+IidYIrS iFucW8Q+HNdxw== 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 33/56] media: usb: airspy: Set min_buffers_needed to 8 Date: Thu, 12 Oct 2023 13:46:19 +0200 Message-Id: <20231012114642.19040-34-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 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 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]); Thu, 12 Oct 2023 05:34:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779553055447579405 X-GMAIL-MSGID: 1779553055447579405 vb2 queue_setup checks for a minimum number of buffers so set min_buffers_needed to 8 and remove the useless check in airspy_queue_setup(). Signed-off-by: Benjamin Gaignard CC: Antti Palosaari --- drivers/media/usb/airspy/airspy.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 462eb8423506..56bc1b23d39b 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c @@ -483,15 +483,10 @@ static int airspy_queue_setup(struct vb2_queue *vq, { struct airspy *s = vb2_get_drv_priv(vq); - dev_dbg(s->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(s->buffersize); - dev_dbg(s->dev, "nbuffers=%d sizes[0]=%d\n", *nbuffers, sizes[0]); + dev_dbg(s->dev, "nbuffers=%d sizes[0]=%d\n", vb2_get_num_buffers(vq), sizes[0]); return 0; } @@ -1011,6 +1006,8 @@ static int airspy_probe(struct usb_interface *intf, /* Init videobuf2 queue structure */ s->vb_queue.type = V4L2_BUF_TYPE_SDR_CAPTURE; s->vb_queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; + /* Need at least 8 buffers */ + s->vb_queue.min_buffers_needed = 8; s->vb_queue.drv_priv = s; s->vb_queue.buf_struct_size = sizeof(struct airspy_frame_buf); s->vb_queue.ops = &airspy_vb2_ops;