Message ID | 20230914133323.198857-25-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:172:b0:3f2:4152:657d with SMTP id h50csp359671vqi; Thu, 14 Sep 2023 06:46:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEgdrU3dQap3Ldo+pbkRYIbwevIa5icDXNgDucKlCqQQvrZSY10fy2cYA+i1tTdo0r+08k X-Received: by 2002:a05:6a20:430f:b0:157:76c5:8f3e with SMTP id h15-20020a056a20430f00b0015776c58f3emr5870862pzk.45.1694699193640; Thu, 14 Sep 2023 06:46:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694699193; cv=none; d=google.com; s=arc-20160816; b=Tdrkaxl03pTNECrMLh3kW9GvqE+FfrVdP5GBsWgU+YtnX2BbhzOrU4sQrwUuRm3RkV uHt5IDsMrVLZ2pOVAEfkqOkSrun4Ex+gmro6ul62qIbeX1N9Je0W2KL7ayn42sqJoxt3 LeKsHYIauMx6BoDbxArJ70KDPj0HPmvkUngeg/AUAnwvAH3diBQEr0LV9pHG6LG3bchV 0va+BfLm1yViaJnLm7eQmY9uMVNqlyRg0dNk7h8QpTo0e+7SDgkQoLcJgqimBtWrR6lW VTzXkzs8DJv0HF4/NdPGpd6FlaRItxVwTjwefh0J5pceIwzuMjuB8d+CDft61hutcLQQ z9BQ== 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=kRY1Y8UmuB3bOAVn1DjviZOqkQmeQ20ZSWWBbzh2Ejc=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=sRwXz4w733witF6s3rcob/mFmG3H84DS7PPOPYZybiSt36nEQLqWhqUPH/pK76Tsi8 n1SgmLqqd6AdouviBUNU7I2TjtFnzX3bwq1gJd9wFWySUvWZecPWRoV8rQrFf3bwUzIe Or4zVtCOfEE6Pz1vlVFxuaQbg6IKwBkaFzXDfb03eyA6TArJUe9AqAeckUPj0rqOrM+U PzdobP0u0usdiJvmnTDQH0GxmsQJ1sjS1cJ/jsfxs45AR+y+jCKd14NaXZDxQ2HCiyC/ mr5re+he+aLQdvPEBOb4OHXhxW7J9Y82lKCS94+jaKJK5FxkWJoGx0VdQD2UAyf/5RhJ 4HuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HGrzjpCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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. [23.128.96.34]) by mx.google.com with ESMTPS id a1-20020a170902ecc100b001b8a70d11e4si1827122plh.529.2023.09.14.06.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 06:46:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HGrzjpCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 3846085A0DFC; Thu, 14 Sep 2023 06:34:44 -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 S239694AbjINNej (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 09:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239212AbjINNeC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Sep 2023 09:34:02 -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 3AB152108; Thu, 14 Sep 2023 06:33:45 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:36f2:37bd:ccbb:373f]) (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 A9FD66607378; Thu, 14 Sep 2023 14:33:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698424; bh=BcQqOPN9BFM33EPpszUjysR3LWc4nekHpVvypyNeDb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HGrzjpCpmFxjKl+xk12MOrY+MAGIB4u3LD8uzE5j+yG7VVUQIygb4veFQ1xCJm2qN 7N6Tamio7lxOVD8pfP3gE5v7dD/QnlDk4KY8kejzl3Uo1uBCYl5lQO1D2EKwZ2ub9Y LsMZl7uTJvHisiPba1wwyGF1/Bm040tvPT+fpBf9l94FVfVavC3Prnf5TqF+dz3FVR VhZTziEGD29c1Z47nVHkMzJHfNDvohrqsrqkAelEfBTjRWeqbZFDfPxR6z5eo4TYlL n8okpZR62/R9k08yiq/rRBS/x7JdONAbNeIjEb2VEESBf0BXjS9Ww6GjCSrbAIh8DC ROYWEhkR+lq+w== 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 v7 24/49] media: pci: dt3155: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:32:58 +0200 Message-Id: <20230914133323.198857-25-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230914133323.198857-1-benjamin.gaignard@collabora.com> References: <20230914133323.198857-1-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 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:34:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777020901469415358 X-GMAIL-MSGID: 1777020901469415358 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Sept. 14, 2023, 1:32 p.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffer field directly.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/pci/dt3155/dt3155.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On 14/09/2023 15:32, Benjamin Gaignard wrote: > Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > --- > drivers/media/pci/dt3155/dt3155.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/dt3155/dt3155.c b/drivers/media/pci/dt3155/dt3155.c > index 548156b199cc..d3abb0e093c1 100644 > --- a/drivers/media/pci/dt3155/dt3155.c > +++ b/drivers/media/pci/dt3155/dt3155.c > @@ -126,10 +126,11 @@ dt3155_queue_setup(struct vb2_queue *vq, > > { > struct dt3155_priv *pd = vb2_get_drv_priv(vq); > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > unsigned size = pd->width * pd->height; > > - if (vq->num_buffers + *nbuffers < 2) > - *nbuffers = 2 - vq->num_buffers; > + if (q_num_bufs + *nbuffers < 2) > + *nbuffers = 2 - q_num_bufs; Just drop this, min_buffers_needed is already set to 0. Regards, Hans > if (*num_planes) > return sizes[0] < size ? -EINVAL : 0; > *num_planes = 1;
diff --git a/drivers/media/pci/dt3155/dt3155.c b/drivers/media/pci/dt3155/dt3155.c index 548156b199cc..d3abb0e093c1 100644 --- a/drivers/media/pci/dt3155/dt3155.c +++ b/drivers/media/pci/dt3155/dt3155.c @@ -126,10 +126,11 @@ dt3155_queue_setup(struct vb2_queue *vq, { struct dt3155_priv *pd = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); unsigned size = pd->width * pd->height; - if (vq->num_buffers + *nbuffers < 2) - *nbuffers = 2 - vq->num_buffers; + if (q_num_bufs + *nbuffers < 2) + *nbuffers = 2 - q_num_bufs; if (*num_planes) return sizes[0] < size ? -EINVAL : 0; *num_planes = 1;