From nobody Thu Nov 14 05:14:13 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2353FE784AD for ; Mon, 2 Oct 2023 12:08:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237251AbjJBMI0 (ORCPT ); Mon, 2 Oct 2023 08:08:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237104AbjJBMHA (ORCPT ); Mon, 2 Oct 2023 08:07:00 -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 ED1C410B; Mon, 2 Oct 2023 05:06:46 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:9537:67ca:c85e:d0ae]) (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 5E8DB660737B; Mon, 2 Oct 2023 13:06:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248405; bh=fi+Fxcs6m07q1y5Umer9Ad8BDnSh9/sSAfF+r67YVOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNtrc/14ePLbzUGNjTop8fqP2YK1vdXo9H5GauskSor4l7g+N3LiRTM1tc95B3/+8 3LFN+DXqbzYqZnSDl9YwCr0fsCuXxwh5g+xuuRzo0BJ5iPPHSaca8T3isV8tAFLKa4 6G9EYstq2tNdnKfWQj+MgVC1uTpXBBrzpvwhkIyh+5eZgGut8jrjD5cIK3qAeqxaRA 4jRFcLcsdQ2hKd2CdaP5dWzoroHT9aGvg2DotTgu5waQGrmY/1n7UmPe3KFO9M4YsL aSTT3R9iuGvS/gZkDlZJmtiE33sOQs9IFxyamacimTwp2TNRN4Hj3cx4BxLUh59Nhc FhK8tnZxrPQ/A== 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 v9 39/53] media: usb: cx231xx: Set min_buffers_needed to CX231XX_MIN_BUF Date: Mon, 2 Oct 2023 14:06:03 +0200 Message-Id: <20231002120617.119602-40-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002120617.119602-1-benjamin.gaignard@collabora.com> References: <20231002120617.119602-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" vb2 queue_setup checks for a minimum number of buffers so set min_buffers_needed to aCX231XX_MIN_BUFnd remove the useless check in cx231xx queue_setup(). Signed-off-by: Benjamin Gaignard --- drivers/media/usb/cx231xx/cx231xx-417.c | 4 +--- drivers/media/usb/cx231xx/cx231xx-video.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx= 231xx/cx231xx-417.c index c5e21785fafe..fecdb12f5ef7 100644 --- a/drivers/media/usb/cx231xx/cx231xx-417.c +++ b/drivers/media/usb/cx231xx/cx231xx-417.c @@ -1223,9 +1223,6 @@ static int queue_setup(struct vb2_queue *vq, dev->ts1.ts_packet_size =3D mpeglinesize; dev->ts1.ts_packet_count =3D mpeglines; =20 - if (vq->num_buffers + *nbuffers < CX231XX_MIN_BUF) - *nbuffers =3D CX231XX_MIN_BUF - vq->num_buffers; - if (*nplanes) return sizes[0] < size ? -EINVAL : 0; *nplanes =3D 1; @@ -1777,6 +1774,7 @@ int cx231xx_417_register(struct cx231xx *dev) q =3D &dev->mpegq; q->type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE; q->io_modes =3D VB2_USERPTR | VB2_MMAP | VB2_DMABUF | VB2_READ; + q->min_buffers_needed =3D CX231XX_MIN_BUF; q->drv_priv =3D dev; q->buf_struct_size =3D sizeof(struct cx231xx_buffer); q->ops =3D &cx231xx_video_qops; diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/= cx231xx/cx231xx-video.c index e23b8ccd79d4..26b593844157 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -717,9 +717,6 @@ static int queue_setup(struct vb2_queue *vq, =20 dev->size =3D (dev->width * dev->height * dev->format->depth + 7) >> 3; =20 - if (vq->num_buffers + *nbuffers < CX231XX_MIN_BUF) - *nbuffers =3D CX231XX_MIN_BUF - vq->num_buffers; - if (*nplanes) return sizes[0] < dev->size ? -EINVAL : 0; *nplanes =3D 1; @@ -1805,6 +1802,7 @@ int cx231xx_register_analog_devices(struct cx231xx *d= ev) q =3D &dev->vidq; q->type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE; q->io_modes =3D VB2_USERPTR | VB2_MMAP | VB2_DMABUF | VB2_READ; + q->min_buffers_needed =3D CX231XX_MIN_BUF; q->drv_priv =3D dev; q->buf_struct_size =3D sizeof(struct cx231xx_buffer); q->ops =3D &cx231xx_video_qops; --=20 2.39.2