Message ID | 20230927153558.159278-29-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2946033vqu; Wed, 27 Sep 2023 15:51:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGB6kKRFezCE43Y4ezMtr40RkrrcsYMYy5V9YpYUNt2iToZPHKMksvLEGQMNanxP+lro4QI X-Received: by 2002:a17:906:1db2:b0:9b2:74a1:6b30 with SMTP id u18-20020a1709061db200b009b274a16b30mr2916391ejh.33.1695855119134; Wed, 27 Sep 2023 15:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695855119; cv=none; d=google.com; s=arc-20160816; b=bhtzlaonpe1G/wP+FmKcpKDnASbe7D+pjHstDWMKOgI6AbfMX2LFX+lmxLF6Ka5GBw msai4lmPaWhwWMCR33SLqVSKLqaFe9W+u+rLI14enVoRY5w3cAmNxZfsKuFJCJYfVLMe DLOu4bpB/hAKH0UyNzatrwkprVQ3wxBoUY+0YNB5Vz/DEW5vd91ObGxGbK7pheVkwZfB a6y27OAn089B+qPrzsFhgMboAnbcHFyqVohLFVhe2b2scYmiE/4VlJQ3pC2dYb2ar++b ioVkWti2hPZQ8cRPmmQsNTpMF5QD/zy2XmarL/4rN7rh27y/8SUOhgJFlNYSTtqbBH3l r+MA== 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=APYp0uFJC2Cv/vh8gdm1S+i0NM5yJouihmXqf14V/JE=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=BAvGwaUb8YCEWiPDxte9FcZMmRl3/77PSAKE/iZKVvn2pfB4KxfG4WiKzfMggwGDR8 T8Th1F9ltXxtqBY5ub6xTLdZkxRjy8w/7kXWSZ7UnC20lCJC1IKWtt8t8zTXT/UZWB+a RAehMGNlvIwpVzpj1BpX63Nwfk9RS8mvZ1ZvrDTNiUJuT3C6efa7tZ0GZ1vXsDXFmOae WoUmkNx/X9xSWjDydkvN7WS6E/9Astc44HR6+4T7kpZ7ePOhrbj8PvWjas1ynvpG92nH yaQujqm82Q3Ar09s8SmSn9lv4lQlzMstmMNeSb7NXkohmkwDVQpqEahloPsbEPQz4sZH EJaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XmS8fYA2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u21-20020a1709064ad500b0099b41f2c735si13358944ejt.921.2023.09.27.15.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:51:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XmS8fYA2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 8D638801B3D9; Wed, 27 Sep 2023 08:38:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232988AbjI0Phr (ORCPT <rfc822;ruipengqi7@gmail.com> + 19 others); Wed, 27 Sep 2023 11:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232655AbjI0Pg2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 27 Sep 2023 11:36:28 -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 B59AECE3; Wed, 27 Sep 2023 08:36:22 -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 EF6316607331; Wed, 27 Sep 2023 16:36:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695828981; bh=ds3q8wqXSU9KVQQlLH/PuQAEX1eguF3zVlgf4I/w/H0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmS8fYA27pZoEZL5doxZqAghVjP0gftxnMGPisYulmq8+qaXZCxl5VywizfdJKpYh rYGYb4wf8qqc1lBxVRmXchlpv9XV9nAOdiCz0xrfoCpqmNoZpudVJQXnEYge6gri2U Bl7a4KZcGn+LdwbpR1n1Y/qvCmEaY2nTgI67O3KD09OhmIC3BHMmRmmlSi5DyIjo+7 C38pJSkfNYqxyYHVXCFArYmtRwqbg56SN7G6J49atPkA5a9iiKa2FYPbAq9DN4Jxwq wIsr+ipB6y/3A8im7Iw8sF9dWz0pLrJh3hkuM28sZNslo+nNIotewVEJc/rv9YmqkR nzbSvQbHeFbIA== 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 v8 28/53] media: pci: tw68: Stop direct calls to queue num_buffers field Date: Wed, 27 Sep 2023 17:35:33 +0200 Message-Id: <20230927153558.159278-29-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 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,RCVD_IN_DNSWL_BLOCKED, 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: <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 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:38:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778232977204572624 X-GMAIL-MSGID: 1778232977204572624 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Sept. 27, 2023, 3:35 p.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffer field directly.
Remove tot_bufs < 2 test because min_buffers_needed is already set to 2.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/pci/tw68/tw68-video.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 773a18702d36..c0a8257b02ca 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -360,13 +360,11 @@ static int tw68_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct tw68_dev *dev = vb2_get_drv_priv(q); - unsigned tot_bufs = q->num_buffers + *num_buffers; + unsigned tot_bufs = vb2_get_num_buffers(q) + *num_buffers; unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3; - if (tot_bufs < 2) - tot_bufs = 2; tot_bufs = tw68_buffer_count(size, tot_bufs); - *num_buffers = tot_bufs - q->num_buffers; + *num_buffers = tot_bufs - vb2_get_num_buffers(q); /* * We allow create_bufs, but only if the sizeimage is >= as the * current sizeimage. The tw68_buffer_count calculation becomes quite