Message ID | 20231012114642.19040-26-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:2908:b0:403:3b70:6f57 with SMTP id ib8csp1165450vqb; Thu, 12 Oct 2023 04:48:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsdn3SGu5fmYi/goCxZhX1gy4inNYFrJ+UGUZxhAT5oXi4Pbfyb6glVX0GsmerqGkYtyTb X-Received: by 2002:a05:6358:e91c:b0:143:6813:bffa with SMTP id gk28-20020a056358e91c00b001436813bffamr19045080rwb.0.1697111335436; Thu, 12 Oct 2023 04:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111335; cv=none; d=google.com; s=arc-20160816; b=lWMH8aVJtIjwCgzU5BHq9D15J7EI9UrlW0MfiQZp3Cx7N5gfzwFKKeclsePainDhU7 hiHdWRBnIPS/CvTgoDsyBHFDX0nnrR4byPSyHGBjXeA7qLCtuuLXgAINi0dOOQcKKZki cDT/EL2EyGhkxNX8tRbpqSRfSbmHdZXpbmsguK5Euh/pYYnxKD3Muhqyb4bASlyArQ5i b7dA3PU3P9vHJNCvPyIUT01MHVtGutu6Yp2ThZRzd44cT8ooEM7DZJz/iLdygsTPp8p7 Ua7bD683TUlrK5+DzkVf6G64J2/Uc9izQt0OcvQuNe0L6lDc5EuSTH/iYT7he63TASM/ G10g== 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=ziV2hb4ohbfnjPJz2x4Pd4VE/hmi7lg5RaQe5DPV4Io=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=KrcM1SaP34NjtQZxSBGkEIDOEicLxrDOhe6ObP/YMHQasLxP4rYTtZlFuZs0hyrTHS g0yKya5faWM+lg6JhioVPY09EMxQ0uX60j+jNBNXyoEEDV9XErJdHlxD/NjJ0HnPzVhO 5OmXhn0aKyxTx4wiHzZSGyJEjkz9VNodBWGxm0A89vWrFf0/uAhO8j5VERCmOv4+IpTF O0sPTE7P07zikmiCeNA8BS92Yk3VOd8bm9iMr4Tmq0J41PsiU+jjR+2qokmopyNvJojy PboUYLW3mmQcHNVhXy96lnNNmK7xETDpgMsU85PL3M3mJIDcQYM1W10hAzmukSVBpPEc s+ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LjSTgXHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id dw8-20020a056a00368800b0069f456b74e9si12033278pfb.292.2023.10.12.04.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LjSTgXHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id C60858374BB0; Thu, 12 Oct 2023 04:48:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379164AbjJLLsF (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Thu, 12 Oct 2023 07:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378613AbjJLLrN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Oct 2023 07:47:13 -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 A1EC9DA; Thu, 12 Oct 2023 04:47:04 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7ae7:b86d:c19a:877e]) (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 B3A04660734D; Thu, 12 Oct 2023 12:47:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111223; bh=zysh0fIOtYpsYqIRMileMUIIdpZZkRuacJmXooFftR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LjSTgXHJlxgyZ+bvIf6sMbUqVS/2vBIxqlUtcMc0jxVNsA2FpOa+Ek9Ek0PJTHjUT 901g/0zx77kLJ9lQ+xak0DJ8TojxT/k8YoYuoUUmBEuQm7kq92MVUWdMC1BIwO/MdO Kezi2LxtDCibe9m4J39eVUYQ228tscXbqmirgSvmALVKm3rX4KSiYKf3HHu0/uKUWr SdzhvuD+0vpARnkQvPWoe1JDyk6cUpzrIKEDep8cMXLKv8SN0Mk7m1685XvNjRK1Tf QRaoKH+VBZK+v20t2p8zaoyx7rXQzwdm2W6yv17zqA8B6VHOAGN9OdeFkDo6R8M6uw OAjzhRNHy7jEQ== 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 v11 25/56] media: pci: tw68: Stop direct calls to queue num_buffers field Date: Thu, 12 Oct 2023 13:46:11 +0200 Message-Id: <20231012114642.19040-26-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012114642.19040-1-benjamin.gaignard@collabora.com> References: <20231012114642.19040-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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 04:48:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779550215636954559 X-GMAIL-MSGID: 1779550215636954559 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 12, 2023, 11:46 a.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffers 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