Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp248179rdg; Thu, 12 Oct 2023 04:49:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEScdbqPcBwtJzklNS2UcqBgg+5gvFTGCkFyD+MDJ8sfPtJXK5S778IaSMg+pUxf1CipGuD X-Received: by 2002:a05:6a20:7d85:b0:137:c971:6a0c with SMTP id v5-20020a056a207d8500b00137c9716a0cmr29401165pzj.31.1697111347421; Thu, 12 Oct 2023 04:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111347; cv=none; d=google.com; s=arc-20160816; b=E/+fPxJLnrS5sYSyst+dDi7wSc0DUJRwjCjt4nfIVm+39xYwycX0HrHwT4s7Noin+u 6UrveV3jAXQUfMoRqfTpbTMdrR/4H+ukNtgv4TofEyHJ//FlyZT4FVoTDkjQm8SPKK48 3hLf/8DW9Jm4uJ5P3Y+0CsS7HJvKdXwSDtMOyC67Nv6HtkksBXZ3d6kCxqCs9raM3+Fv joZE/0vPiN8v5AM/aEbuL9byEF55vy2yLxPLLNBwlKOoQKDP7kT4D0tXGzCnNv6HRKRi GAEqVUSMBIs2O5eweFDX2Fz4PLNFI+JvO+BR3whp+rLhuusAckQFifrqKZB288dTre1V sFcw== 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:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l30-20020a63571e000000b00573fc592e9dsi2031442pgb.848.2023.10.12.04.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:49:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; 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:7 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 E2002822CC6A; Thu, 12 Oct 2023 04:49:05 -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 S1379321AbjJLLs4 (ORCPT + 99 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 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:49:06 -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 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; -- 2.39.2