Message ID | 20230914133323.198857-27-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 h50csp377421vqi; Thu, 14 Sep 2023 07:12:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQ1/14Ucn0U0dWWwjuJldhTml2Phm7mBRT1wzpFeDf8wNKNAHoe2qKl4dPe4LSksY461/I X-Received: by 2002:a05:6359:d0a:b0:139:840a:d357 with SMTP id gp10-20020a0563590d0a00b00139840ad357mr4820897rwb.1.1694700727355; Thu, 14 Sep 2023 07:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694700727; cv=none; d=google.com; s=arc-20160816; b=x/1p6OXfa0Rbn+gySFZgXvQcvRhDGDBqtPaR2xvTdIqQiM9l5dHUNACQrz0+jkEsVN Ev8g0d2ewpXJY5TehhHKvadKxw6NrCUFWtcJCNHx7F4xDs6ak7JgQfPrHgbxhX1Jo/8f 27MdmD1ch+9a78NKZ9kAfn0jhFuuGCwf38MBnJmdPtsKLMlqtXz/XdrMl4q3lDVjrIUp zMsGDr/SYM7l2dUjNgxscmDHULBB21hmAHIulAeAHPiDWZu3xGi7YlfuTbD0cGam8dGq iy3rvX4kFkWLRo3ZMOaEuhAz4qOUIjJ8NbXW+FznY3fafMZ6UPedFVKeD9+nnU2+icCr 8vbg== 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=X4wPFySt/lU5j9AkoHLhqGTEN8n0F3jcw+kxHilaaRg=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=Lhw57S7bH7KFsT9P9G3w4kn7SlmV13uM2+ThBsFkFHAHnMX34S0JvkSjz3TH0ZQklp aijhIxRU8Q0nNf3fSEZ4fSknQOWZ4R8vLTj+82UzRpKQkC5jXDhILFIGS2QNuqc8E3sr oFj8/oZCYTXQ9S87y5WgIoiINry3Bxc/WCzekT+UCD6ydSBy9vSGYt3AI9VMQ6P1dbNr VwUPS4QHA7ONeDdNUGHpDcOGG0jRl3hdTdXFrHyVFZg0Ryv87YOgUQNOpeMtqB7YAmKt wwrIGNhCRzW1FZdwkXCCfWyYFUuntfnQi4p4RnWyl4b5r+E+24xis0P73xWNC14mNIJY fQEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=n56v+JXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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. [23.128.96.33]) by mx.google.com with ESMTPS id a5-20020a655c85000000b0057755d654f4si1589575pgt.628.2023.09.14.07.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 07:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=n56v+JXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 3E57A81CDE0F; Thu, 14 Sep 2023 06:35:57 -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 S239714AbjINNem (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 09:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239315AbjINNeC (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 3C7292113; Thu, 14 Sep 2023 06:33:46 -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 B5919660735E; Thu, 14 Sep 2023 14:33:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698425; bh=KMPzPsH6nYT59+TnmiRbCQNg0tV3gkCBNX7OoLfQWFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n56v+JXLtBEX5Ogmuyno+QnMPo5soqucOknczK2gLaEl+yd79iAC9D4AfHRPTuCtO xJjcxBuOKoffcBTTB/85iFW4CM3ZupfZWkGVp8bY3SFygB09E8Y1unNCk4h+pS9Iu0 vyOdJBUGC4Q7MzqUWh/iZ/7o4z1oAHrWMSVCp9Q0V3P4FRpez6BozS2DmFJbvul8rd fNREY8IB7VzHqsoDVnqKZG5lSqJUrVlAZATDS95qjxvmV38m8ta87C4yEswKcFl3Pv 5X6SuUwtiu5chNbf4E6jak2yXfwTOxInmyl3V4EIi8XXeQVQWM5JOY73JkTBe7muQ4 IU+RWTcCp80Nw== 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 26/49] media: pci: tw68: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:33:00 +0200 Message-Id: <20230914133323.198857-27-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 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:35:57 -0700 (PDT) X-Spam-Status: No, score=-0.9 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777022510286336967 X-GMAIL-MSGID: 1777022510286336967 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Sept. 14, 2023, 1:33 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/tw68/tw68-video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 14/09/2023 15:33, 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/tw68/tw68-video.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c > index 773a18702d36..35296c226019 100644 > --- a/drivers/media/pci/tw68/tw68-video.c > +++ b/drivers/media/pci/tw68/tw68-video.c > @@ -360,13 +360,13 @@ 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; This check can be dropped since vidq.min_buffers_needed is already set to 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 Otherwise this is fine. Regards, Hans
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 773a18702d36..35296c226019 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -360,13 +360,13 @@ 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