From patchwork Wed Sep 27 15:35:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 145562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2858436vqu; Wed, 27 Sep 2023 12:37:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqcHUobiAzesD6iKdIS0USz5dzzpbmcgZuu8fm1RlS8H+L4aZ5VZV9wHLaImlJiuZNB4Wv X-Received: by 2002:a05:6808:617:b0:3a9:307a:62aa with SMTP id y23-20020a056808061700b003a9307a62aamr3161896oih.22.1695843471370; Wed, 27 Sep 2023 12:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695843471; cv=none; d=google.com; s=arc-20160816; b=OCCF43C1totmMCVYMVsq+jz72xISPb2Eq3lzadzNdkzvyZIsQi1Hxa5Gbfg49goagC EKUBLumzm1LycWLHYs/uN93PPE0nr9WTsOPqa4y8ijyqk/sB6VVlGSPaRUCkaYlDdxY2 VJMXnc3wXw1cFy8ZavE170Rbh1PUcY4U3M+dMTg6WgFSW8ZDlNKIlORvizRuk+DdzjHp d/ZhtCUVgElrn5DEguPkKzh+4qnvgfcV/f6OIw6CXLU/AXdz1fOqh255nPMX2o3usD4p YOpBeGO1LUka+SzbTR2I/8p5HvQgSB4Q2n5CZsmFIC3EjFYfBfxhumpV6c2GFSkpwxUs ErbQ== 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=qTuPHPU4Io44nAdkQT6nBOAqUL8jchiAXtKAUc5aY3c=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=myN6HwfYiY3Bxa3bWXZyyfgtlu83qPG/n/RLEnx0krDd3FWKb1ifdXEl9qncqM4ML5 xKhjOclnYu3h8vojjvDwBOfBt7/Q87f0cNQZxrEbaqlD9OuhPmc+buyWMZ3dI4Relh8H LlmKtDnuNfFPX5PFNNg0f9nB1dLcITvYqhTRREjDaZd+W76IlagFg2JOpPv8wticRnZM sBOa0ang+AFwdm3rQJZVwGmsckjdXKxJR8crK4qCdSYFPvMKLcP2wF4qCzBxit24Tc67 la5oSPg4TvSBXJZacB1to0H3EKZTBSi1lNdFi4S+WNLXAKNs0YbPvUwfA7Km01RhnzTB Gx+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ONqyrTE2; 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 g4-20020a056a0023c400b00690b6d83e0bsi17174390pfc.186.2023.09.27.12.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 12:37:51 -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=ONqyrTE2; 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 52E918125FFE; Wed, 27 Sep 2023 08:39:20 -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 S232931AbjI0PiX (ORCPT + 19 others); Wed, 27 Sep 2023 11:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232725AbjI0Pgd (ORCPT ); Wed, 27 Sep 2023 11:36:33 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30BC41AE; Wed, 27 Sep 2023 08:36:29 -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 A00876607373; 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=1695828988; bh=nwepyznt8z6pxABzkpFHR6clGV59kYVToyX8aj6cN+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONqyrTE2hGWLwWIGz+oEE+zkDiSdp7AY/6CC6gkND7/p8p/mpNXXGuXdyjke8Eqbv 4zatZ6INn/pGM7xDf07Z3CaOXgauPQ8B4stL1tCXSWnYtjpGir2/VmwXkdzOqbBhMY dMTyrV4uLADgw0lgk37/dB5+iPTX9k2Q0l8vrSoD3Usi59ebktNrYxpXvqdRB33BSf d+hzKTGzNwgKEM2x9luscYeYxeOxc2/UbRb5Nm1bIeiLC62A+ugBDlzS1ZxOCRCeRO o2v/I4Mxjf+7IhJjbN4h7BSBuVz0VYGANcRNq5sg+WrrPPr0zIcQkWv+EpgckcGJTV lbtvLRwdAsmdA== 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 41/53] media: usb: usbtv: Set min_buffers_needed to 2 Date: Wed, 27 Sep 2023 17:35:46 +0200 Message-Id: <20230927153558.159278-42-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:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778220763548106467 X-GMAIL-MSGID: 1778220763548106467 vb2 queue_setup checks for a minimum number of buffers so set min_buffers_needed to 2 and remove the useless check in usbtv_queue_setup(). Signed-off-by: Benjamin Gaignard --- drivers/media/usb/usbtv/usbtv-video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c index 1e30e05953dc..0e9e860be47f 100644 --- a/drivers/media/usb/usbtv/usbtv-video.c +++ b/drivers/media/usb/usbtv/usbtv-video.c @@ -727,8 +727,6 @@ static int usbtv_queue_setup(struct vb2_queue *vq, struct usbtv *usbtv = vb2_get_drv_priv(vq); unsigned size = USBTV_CHUNK * usbtv->n_chunks * 2 * sizeof(u32); - if (vq->num_buffers + *nbuffers < 2) - *nbuffers = 2 - vq->num_buffers; if (*nplanes) return sizes[0] < size ? -EINVAL : 0; *nplanes = 1; @@ -892,6 +890,7 @@ int usbtv_video_init(struct usbtv *usbtv) /* videobuf2 structure */ usbtv->vb2q.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; usbtv->vb2q.io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; + usbtv->vb2q.min_buffers_needed = 2; usbtv->vb2q.drv_priv = usbtv; usbtv->vb2q.buf_struct_size = sizeof(struct usbtv_buf); usbtv->vb2q.ops = &usbtv_vb2_ops;