[v14,20/56] media: dvb-frontends: rtl2832: Stop direct calls to queue num_buffers field
Message ID | 20231031163104.112469-21-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp363493vqg; Tue, 31 Oct 2023 09:32:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHN7KG6MWSFdyE5ygvZ9bXPBmgAgrWfZhEiiIoEfxZV0im7Pz3FusO6jmpbPFAG/9xAhs2a X-Received: by 2002:a17:903:244d:b0:1cc:4fd6:71c9 with SMTP id l13-20020a170903244d00b001cc4fd671c9mr6164968pls.19.1698769979631; Tue, 31 Oct 2023 09:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698769979; cv=none; d=google.com; s=arc-20160816; b=PUJCKB0kgOrr7vFgX9qnHfSafcfZ1s7mV25A6rxotPITS93WnvSOe5RRgSV/B0Wv78 VoutioPhP1UZLVej59jW8POGuguSHu2GTRo3ooNw4MB/dx9+GOFcvQtiYPyt0H1fjGKt 2KBpxm+qLgwOe2QgQfdkfKdiMuuzpqrOq3s0EtIBGnI2AJWCu9y8oNdx/YpU2aoedJWc FECx7qzP+/oQnn30kdJXS923PeZEL7O292428vDpaTH3OwjmoiBkj2s9CuAeZPHGEVvI 2oJeFQS8WQIjSI0Wb9jHQaTOYN3yzX10IV/33D78cC1HnpjAooWazzS3fpF5fduSV/Hu uo2Q== 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=BVc3Gw7um+ugtNMPbdIQp4POT0sbfp8d45vmiRVz7f4=; fh=p0AH8hgimiy85Lh1cXLIqpi5zFbeLa4s8fsQNMmUBzM=; b=FioGjM2EriFnrnFjOpuRq6gpVaBYolKc2mbp16j5WwKW9TIoOsaMu/JM2o00mTurRO J78AcIcoGy8BpmDW7wlvaoA6x8DXuVa5F8NIp39N5/XKxqivXAAnj7olPlubGM9o1DFF Bg632uhkH80VNo4UJzH2HXONvNxcWWY2zxjBAL32fco04pV+h39EmhKYI+iG9YqPmpse q2rHCRam7k5zPnT5bMQSrV9Taojg6MPf5GU4ynLRqYJYgFjmyhO+pefs0vPXz0T3YY42 0VjcPUCG7pKz9rwxWmq+YAr5tH8k3mXRl7CBPz00mMHQaRW5JYeD3UgJhYEQXroPyoMw lQSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aW+gOBlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id jb22-20020a170903259600b001c449fb7bfcsi1183387plb.353.2023.10.31.09.32.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:32:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aW+gOBlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 87456801B3FB; Tue, 31 Oct 2023 09:32:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346222AbjJaQcp (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 12:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345270AbjJaQcI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 12:32:08 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D8B1B5; Tue, 31 Oct 2023 09:31:45 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:c562:2ef4:80c0:92f]) (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 DBA9866073C6; Tue, 31 Oct 2023 16:31:43 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769904; bh=mNj/uXX2BkOwU+t/CAhw8+caswKl9nv73YeSkh4q3yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aW+gOBlKVm4CrU6qFiH+hj5sWD0UalI04+iJj4eFob+S86dBwIbLl0KxpRFPwB0/j 4B9IHVZTXs3Px0DotdDYxRX3kqMNML6mUfySpnezIxx1Pt8w+shrU8Y5LPONs4SZ60 oPs5TEIsAV0dyF4ltkCvWoAH4ekLZqx1cvMoXY4CszHLBJdx2l+iN7a/qTUjq7d+ci qtZPyrMJovfnhGwoON4sAzlxFyKwAshZI300AHckoWZl5SZlZhR1Wa+CDkDQRvYrvM 0ts5s4Avyutrihi0xTCeoQrZDGXjqSk7YNOne9xRgyDz5U0e7Fo2rJe1Yz4kY+n/Sd eUTEjSePSeQFw== 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>, Antti Palosaari <crope@iki.fi> Subject: [PATCH v14 20/56] media: dvb-frontends: rtl2832: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:28 +0100 Message-Id: <20231031163104.112469-21-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231031163104.112469-1-benjamin.gaignard@collabora.com> References: <20231031163104.112469-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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 (snail.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:32:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289429961564910 X-GMAIL-MSGID: 1781289429961564910 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 31, 2023, 4:30 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>
CC: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/rtl2832_sdr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
W dniu 31.10.2023 o 17:30, Benjamin Gaignard pisze: > 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> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> > CC: Antti Palosaari <crope@iki.fi> > --- > drivers/media/dvb-frontends/rtl2832_sdr.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c > index 02c619e51641..023db6e793f8 100644 > --- a/drivers/media/dvb-frontends/rtl2832_sdr.c > +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c > @@ -439,12 +439,13 @@ static int rtl2832_sdr_queue_setup(struct vb2_queue *vq, > { > struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vq); > struct platform_device *pdev = dev->pdev; > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > > dev_dbg(&pdev->dev, "nbuffers=%d\n", *nbuffers); > > /* Need at least 8 buffers */ > - if (vq->num_buffers + *nbuffers < 8) > - *nbuffers = 8 - vq->num_buffers; > + if (q_num_bufs + *nbuffers < 8) > + *nbuffers = 8 - q_num_bufs; > *nplanes = 1; > sizes[0] = PAGE_ALIGN(dev->buffersize); > dev_dbg(&pdev->dev, "nbuffers=%d sizes[0]=%d\n", *nbuffers, sizes[0]);
diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index 02c619e51641..023db6e793f8 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c @@ -439,12 +439,13 @@ static int rtl2832_sdr_queue_setup(struct vb2_queue *vq, { struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vq); struct platform_device *pdev = dev->pdev; + unsigned int q_num_bufs = vb2_get_num_buffers(vq); dev_dbg(&pdev->dev, "nbuffers=%d\n", *nbuffers); /* Need at least 8 buffers */ - if (vq->num_buffers + *nbuffers < 8) - *nbuffers = 8 - vq->num_buffers; + if (q_num_bufs + *nbuffers < 8) + *nbuffers = 8 - q_num_bufs; *nplanes = 1; sizes[0] = PAGE_ALIGN(dev->buffersize); dev_dbg(&pdev->dev, "nbuffers=%d sizes[0]=%d\n", *nbuffers, sizes[0]);