Message ID | 20231019125222.21370-43-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp361151vqb; Thu, 19 Oct 2023 05:57:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3bpXBymuSAu30O3cbaFOQvSssIxLTV+3JlrOXZhgBz6NBw64/l2YgBF7/lK9bEpEVlBRi X-Received: by 2002:a05:6a21:8196:b0:16b:f586:3c4 with SMTP id pd22-20020a056a21819600b0016bf58603c4mr1731928pzb.58.1697720270570; Thu, 19 Oct 2023 05:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720270; cv=none; d=google.com; s=arc-20160816; b=WbezxfxtsPKBlLHkfPuR3NAk6J1Qa34ML1Hi/5T6VPRh1IpuJIP3euIszqoD99orvS 3hk7MI8kIr9IXKbq980kFnDQQChiO21uk3b6fEA77FxYcfMCelQ81/dJymdQrzrKETAn OKwjwO8/oZ25weJlEXTbOgVxhDNmPm3wx4dUIxdid2FQ/zpIAfRV8YtG6X5LLDgitKCd AXuujgF1jOu2UgE0/V1CHe1FeluO8fUbpWkA6djwfIIUpw47u3BbtMnEmjfQBP+TRikM dO7czxz2/A0Q5sYzsx8OuQbhwcq978vQc3YZRGPAozWl5u35hMjdZzB4xMfaYK0ssZHx Jx0A== 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=cIauNEfyyc8ygY2CYOkqXtpUWGt5kjIwrFn6YVVwin8=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=c7xCos3+FwoxyywV9Hc/9YaWDiy8cQbpP7wsqkLkY8gDlI6uJ7oB4G0LnC/nI1IT64 tJTUIKZE+YpeaBJWpqFPgYmDVjSjn0hARVtL1NqgKxDgN3Le7LSYrogvp2oDd9C4i7qX rZ7zL1UByjAV+7P1azbFSdEey5L+r0iONqFn7kANccUb6OQKMR/WFKR9v809cPzavJzl OQ79Tk3uKz3UiLpQaFNBbSgW81p4BGmAa5xL0FHnaysCB7qkB/Z+ZIG9/gauRZgd4iAb /H+EJ14Pbje+D35s6xKyLYvdIpkVI+tuNHrsSn3V3kVIyo3HesTUqbTw+BQ5U20YLY8Z 4KUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WNb2jdJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e3-20020a17090301c300b001c5cf1c30cfsi2197604plh.435.2023.10.19.05.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:57:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WNb2jdJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id F21468053656; Thu, 19 Oct 2023 05:57:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345835AbjJSM4E (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 08:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346057AbjJSMx7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 08:53:59 -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 8D3C310D2; Thu, 19 Oct 2023 05:52:56 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:ccea:1fb5:34eb:239b]) (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 825A66607387; Thu, 19 Oct 2023 13:52:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719972; bh=KPoxd/SvOk21SjAKuo9XuAAvSFR2sEuxtH4tG5ksUhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WNb2jdJZv+aIVwQ2TG0qLbsO44v0MNz6zFaBmdmv3PzVoLr7OfAB+/Z/+VorUA0J8 LuqF3pyZViUGEsjYYnFMkksprTGNBEvcGEe6z3ghkM6UHN4aIWnH3dBBqHJrl1qOa8 W/pvthI71yevvtGdbyp/VQ7ajxAEEfneNG/tXg/nxE78Ad5AxTi0avalXcklq5wUUQ AIvhZCygpXVtvcmYQq3OrGwRbheJ1xKGnRrGBHTO1nOh5mm8rVvFPgItNBPvE3JHSC SPhrDksE+xGaoNjgO5kWOMqV3eoejokQVFSaCIx2pTs3Sw4Bhc/9nYEvcI6mGHbInY gf+zENHt0M00w== 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> Subject: [PATCH v13 42/56] media: usb: usbtv: Stop direct calls to queue num_buffers field Date: Thu, 19 Oct 2023 14:52:08 +0200 Message-Id: <20231019125222.21370-43-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com> References: <20231019125222.21370-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:57:42 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188730713600495 X-GMAIL-MSGID: 1780188730713600495 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 19, 2023, 12:52 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>
---
drivers/media/usb/usbtv/usbtv-video.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c index 1e30e05953dc..62a583040cd4 100644 --- a/drivers/media/usb/usbtv/usbtv-video.c +++ b/drivers/media/usb/usbtv/usbtv-video.c @@ -726,9 +726,10 @@ 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); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); - if (vq->num_buffers + *nbuffers < 2) - *nbuffers = 2 - vq->num_buffers; + if (q_num_bufs + *nbuffers < 2) + *nbuffers = 2 - q_num_bufs; if (*nplanes) return sizes[0] < size ? -EINVAL : 0; *nplanes = 1;