Message ID | 20230914133323.198857-22-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 h50csp802423vqi; Thu, 14 Sep 2023 21:39:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXnbv1wtHuNsxt1R/OrNgVfMoZQGZCq5twN+0l/zWYcXIedlt3Y+YJ/YD2DesXEx/i7G6A X-Received: by 2002:a17:902:6b0a:b0:1c1:e5f7:a743 with SMTP id o10-20020a1709026b0a00b001c1e5f7a743mr586457plk.55.1694752793122; Thu, 14 Sep 2023 21:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694752793; cv=none; d=google.com; s=arc-20160816; b=U7LjG0z3cJ7Cc2c5InKtiM2gR74cuDyvxVqkso76z1l88eApstdynvFsUNoj0Trt3T NN1wXrK4TRV0kmSx13mZxPSFT8xfS69s8pOJxKnS9Q5ZVZ26g9RQiaAaWh1x/wv9/kdJ FnzvKDgoeHFFCX/D6bztj4kQoIhjT594ZYTPX/t/gF+yUV8n44NfSI0imQ5TAhzJC0C8 pjaNfA7PBRXsnP7tUSJJnzwIJO+X4v5Zzv49uvRIyUYqzUdXO/+wG3YRvq/CAiKJUo+6 rV3c6NEzJLK4YIozkYfYjN3IHpSGijbJG4j1kWTkkrjjfmakSHNn5FIUnMiSjs+PsHao pegw== 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=sY9RP+fPDz1MSqs1Rmax9/Eu2YBR7RvRLW2qBjv36o8=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=gSiBQUTMaOuyiIvxWMyH39zkYeDrlKmzqLFCc+vZ2U2Ha4l8hp7yhqeZlRNrPFGvsz 5Ns1UdH3AphwRIvQy3JOQldkH55OkuSMXqtlTSZgLqQ+NubRJs/P2X/TSOrqSkRsDWqM VIhWuz73i3xSXfW1vg8KsNYY+SxJpIoUqSXP5Jxclpo51zP6PwpFzJa68jH5XUdZVdMI vbTXsUpArHPddx1OKC1qZK/JRm1wkTaWT9ZXuR+zljFSLNeA83hvpQEwcEWA12LzN9R4 6W/GXCz+PJIw3ZEx2EBRC0HkFWlc1HVsYRfo0WbnmzGWIKEJ1g4v3V0vzKWGPN168TPE z/NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=lkLIjEy2; 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 k7-20020a170902c40700b001b3c63eba76si2876826plk.492.2023.09.14.21.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 21:39:53 -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=lkLIjEy2; 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 EE67B81E7266; Thu, 14 Sep 2023 06:34:35 -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 S239322AbjINNea (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 09:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239263AbjINNd7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Sep 2023 09:33:59 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93A091FC2; Thu, 14 Sep 2023 06:33:43 -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 16B99660734D; Thu, 14 Sep 2023 14:33:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698422; bh=aeJc8Jxcb8/QbECmV25qK+8LTdH51/KXmWUpXuI4BR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkLIjEy2vX3bpMH3buUT4cdpI7iRafMZckCzgDYWsix0SUPgu3Jc8uxt7LyFI/4FN zpki5QpXi/wJpp4RUvpkfSVJu5j5QMl9lueRCWkn/VlXfac6kiOCt7yUj64gPTODZT wLnIU5q+RBlJRH1uQh6RLh72Vm8WEFetXbdxsvY8gvnFTTU5bOJtuptiAXMpAD0/ru /wCR2yEG4NgHtL1iG2hqtlUo2K8JiZWp44XQ1+u1dnWMSHHAqdXA1LWFaD77pz9f7r gvMSAwli3PdGl/6EYHWc2QbbHdDP6st86TBiJddI7gFfvzgLJuG4osJSS8ICQPqXUU 3sQ+c6hN6G+BA== 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 21/49] media: dvb: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:32:55 +0200 Message-Id: <20230914133323.198857-22-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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:34:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777077104858048000 X-GMAIL-MSGID: 1777077104858048000 |
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/dvb-core/dvb_vb2.c | 1 -
drivers/media/dvb-frontends/rtl2832_sdr.c | 5 +++--
2 files changed, 3 insertions(+), 3 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/dvb-core/dvb_vb2.c | 1 - > drivers/media/dvb-frontends/rtl2832_sdr.c | 5 +++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/dvb-core/dvb_vb2.c b/drivers/media/dvb-core/dvb_vb2.c > index 3a966fdf814c..a731b755a0b9 100644 > --- a/drivers/media/dvb-core/dvb_vb2.c > +++ b/drivers/media/dvb-core/dvb_vb2.c > @@ -177,7 +177,6 @@ int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking) > q->ops = &dvb_vb2_qops; > q->mem_ops = &vb2_vmalloc_memops; > q->buf_ops = &dvb_vb2_buf_ops; > - q->num_buffers = 0; > ret = vb2_core_queue_init(q); > if (ret) { > ctx->state = DVB_VB2_STATE_NONE; This touches the dvb-core, and should be in a separate patch. > 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]); This is really a generic issue with most of these patches: queue_setup checks for a minimum number of buffers, but that should instead be configured through the q->min_buffers_needed field. A lot of older drivers were written before that field was added. This is a good opportunity to just drop this check from queue_setup and instead just set q->min_buffers_needed to 8. Regards, Hans
diff --git a/drivers/media/dvb-core/dvb_vb2.c b/drivers/media/dvb-core/dvb_vb2.c index 3a966fdf814c..a731b755a0b9 100644 --- a/drivers/media/dvb-core/dvb_vb2.c +++ b/drivers/media/dvb-core/dvb_vb2.c @@ -177,7 +177,6 @@ int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking) q->ops = &dvb_vb2_qops; q->mem_ops = &vb2_vmalloc_memops; q->buf_ops = &dvb_vb2_buf_ops; - q->num_buffers = 0; ret = vb2_core_queue_init(q); if (ret) { ctx->state = DVB_VB2_STATE_NONE; 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]);