Message ID | 20231109163512.179524-41-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp559573vqs; Thu, 9 Nov 2023 08:40:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBQ7ittWAinoCCw92PzXP+1Gso+G/R6FaLao5KfUQ0jUwOMLkpQoYnQ+9g6rs+VgEgyGgL X-Received: by 2002:a05:6a00:1ad1:b0:690:d620:7801 with SMTP id f17-20020a056a001ad100b00690d6207801mr5688809pfv.11.1699548004122; Thu, 09 Nov 2023 08:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699548004; cv=none; d=google.com; s=arc-20160816; b=xs07b2oHYuhg34bvK3HuRwvXR/b1X3xi+BglyzaEDEGImBVdqCzVRt6vt+4kXw/L35 ygSIILsDxQ7gPf/6f11+DiFWBtfzgK/c0NLe4Si83gXT92YYWtb2NqxGwiDkCyHKr11j xsPtn+UeBLGH9+0GWSYbiuJr+YZ2lava8UyvmXWGOojofXtqASwr/leJmJW+pzqqWd77 2pJ9Csh6vtc+ooouxrFUoEgmBoKj7DyXpDFScxJC26JKOfaL5DPkQLDmJaX8+p2appO6 LApyS905QpHctRhRRd44NZ6XHWOH9KC/tDY5d5nH/dSoFwu3yjgMdJPPhqlzqjH9yKOa UpFw== 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=N5mY/5j4XvsBGrpgH9OPkpIx63yHgXn0i+31KACASr8=; fh=t4h1l+tS8anPNnwyX0PglXAWKg/D9M9NAbc0AP3vdGI=; b=rAoh9hyI/f3+j9BqoySw12Eq1JCZvnYuwT8I/JUW3s36HaUWscl7NF89aHCNPNArTD 4byaW1A6KGapDfcxUodumZQLDIydgRtI0ud7NUZCJsx0BWMCWF54FwHDTQb+Knrv9bZn VtUyGTH9bOyF8b/jUjTWsFdaAe+VJjLN2jXxoF4LNxBtM5fgpkNiY7onhUOAlwxFjRTo joFvOVizH3jKzZlBhcwR1VlgzGZ2caUrZHXwfvucpAMUHkPSwVFMzZFdisV40rMYH31z Sz7plH3cgnhhgFVQ9UxX0XayvU+g2w44R/EfiAvgKNAeP9Jb0fVCdpDDu8SjI5Nx3za7 ZBmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NXR8B386; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a67-20020a636646000000b005b106cd44casi7823290pgc.145.2023.11.09.08.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 08:40:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NXR8B386; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 25724837C49E; Thu, 9 Nov 2023 08:40:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344331AbjKIQkA (ORCPT <rfc822;lhua1029@gmail.com> + 31 others); Thu, 9 Nov 2023 11:40:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344278AbjKIQjL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Nov 2023 11:39:11 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C293A98; Thu, 9 Nov 2023 08:38:26 -0800 (PST) Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (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 8DA9B6607421; Thu, 9 Nov 2023 16:38:24 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1699547905; bh=aF5IbNMnW5bzQpY31akTbqKQeSuvyqM5DVbbfQGqSG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXR8B386aaUFbWGbiZLt/MV4badGkLThiUspY89i2hDwgJXKwm9bbwBQXT031S8gT qdj4ZVbirRaVXYbgYvv8HzuFT0QR4xJLlBJFnFmJeFkGy2hwWH21EhWuFPPj8UeaMu CGZxutsWPVKMSmV9mTlJ6lYJAWAhwuKMeEwDGSkj/iQfACDUl/POdLwfTG3Zad4YwO erVthdcOn4MS+SjbHUIrOZSeujiuZa9F13/WvjX7Q5UoMUQfzgQUG84bQYgKqKfn8V nYWtl8eFOAWbpmvmdw1/CxdRwTUm+naWMxOufpjkp9VtWsX1Nm5BH7/8aJRO6geS9x S5Zf2qMZQNuAw== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> 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 <benjamin.gaignard@collabora.com>, Andrzej Pietrasiewicz <andrzej.p@collabora.com> Subject: [PATCH v15 40/56] media: usb: cx231xx: Stop direct calls to queue num_buffers field Date: Thu, 9 Nov 2023 17:34:56 +0100 Message-Id: <20231109163512.179524-41-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231109163512.179524-14-benjamin.gaignard@collabora.com> References: <20231109163512.179524-14-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> 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, 09 Nov 2023 08:40:03 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782105248179472189 X-GMAIL-MSGID: 1782105248179472189 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Nov. 9, 2023, 4:34 p.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. This allows us to change how the number of buffers is computed in the future. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> --- drivers/media/usb/cx231xx/cx231xx-417.c | 5 +++-- drivers/media/usb/cx231xx/cx231xx-video.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c index fe4410a5e128..45973fe690b2 100644 --- a/drivers/media/usb/cx231xx/cx231xx-417.c +++ b/drivers/media/usb/cx231xx/cx231xx-417.c @@ -1218,12 +1218,13 @@ static int queue_setup(struct vb2_queue *vq, { struct cx231xx *dev = vb2_get_drv_priv(vq); unsigned int size = mpeglinesize * mpeglines; + unsigned int q_num_bufs = vb2_get_num_buffers(vq); dev->ts1.ts_packet_size = mpeglinesize; dev->ts1.ts_packet_count = mpeglines; - if (vq->num_buffers + *nbuffers < CX231XX_MIN_BUF) - *nbuffers = CX231XX_MIN_BUF - vq->num_buffers; + if (q_num_bufs + *nbuffers < CX231XX_MIN_BUF) + *nbuffers = CX231XX_MIN_BUF - q_num_bufs; if (*nplanes) return sizes[0] < size ? -EINVAL : 0; diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index e23b8ccd79d4..c8eb4222319d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -714,11 +714,12 @@ static int queue_setup(struct vb2_queue *vq, unsigned int sizes[], struct device *alloc_devs[]) { struct cx231xx *dev = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); dev->size = (dev->width * dev->height * dev->format->depth + 7) >> 3; - if (vq->num_buffers + *nbuffers < CX231XX_MIN_BUF) - *nbuffers = CX231XX_MIN_BUF - vq->num_buffers; + if (q_num_bufs + *nbuffers < CX231XX_MIN_BUF) + *nbuffers = CX231XX_MIN_BUF - q_num_bufs; if (*nplanes) return sizes[0] < dev->size ? -EINVAL : 0;