Message ID | 20231031163104.112469-40-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 t15csp365100vqg; Tue, 31 Oct 2023 09:35:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLUn7fY9qB6HsSWwCTO6q2RyBsA4tWEppAOS9BF/qFNie2RsmWM66qOsYfNcU5gwO8YQxO X-Received: by 2002:a17:90a:2c0f:b0:280:8778:c4ab with SMTP id m15-20020a17090a2c0f00b002808778c4abmr4004877pjd.24.1698770138822; Tue, 31 Oct 2023 09:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698770138; cv=none; d=google.com; s=arc-20160816; b=fv5yCKZuXaxlORtvd7mjhEiIebm+W2Etgf0exE1k4PQl1KL1YOWdd9Ay1UqtwWIPC9 QGL9ZXfoNkCkFfAT2V3OEvoLhYzta1ZFzrOAtX1Xzn3spKyyL5vipQAH9JL9gafOhuet ESX5Orbds2vrTbNrGc0puh8HQcEzYz0wISbjK9sz/1pN89/lXwKtT4ML7C3OzhqG0EPb T+iC+UKc5kJ+UY8IM7JA3hENkF6Svoh0p7eCo7ejxbFSUd/LxeTv4FIZqhyJ2N//30FQ uTvNlj5pomOSZWMu389qmzM7fbc0qexvyrTHXF+svAl9a+IcUJzYM1UMMrn5Lu5P5GCm sAXg== 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=RNH8B9gPylxTtM01bKtOlQf9akbpmUzdDHvgh+kzWPw=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=CvRC4RrxS5QYgi5ubUX3gqYxqodcKI1YleSM7I4Iyhxrxf/aXHmSaYZQYSjYZpmH+/ E4k+9S43O07hXEXFK19ejkfkrVN0kzp30O6B1gNOHUXqZv89DYZjblej+hKWZRrYtSi8 EVvajppiiszOBNNFv8Wl3YLNkDpzN0k239DugoXqMZf8vNn5dW2J626wLmKrwQf9X6SL z0K3QjpNaHcp0HGkLfdY4KrDpgI5nOqE/cC+0vLHTjfNgHzj/TdSZ5P5K5Y6g5XmAgn1 f0H9UTL6g1OgD+rrJL5PH1CZaO8a+OgLbNGiSIx8k9jtPwv4kh0PNJr+tUjP8hZGNim4 Q7FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FtOTC5GW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id ga19-20020a17090b039300b002568a675b65si1163586pjb.141.2023.10.31.09.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:35:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FtOTC5GW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 938F18048E53; Tue, 31 Oct 2023 09:35:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345495AbjJaQew (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 12:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345966AbjJaQeL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 12:34:11 -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 4F4031BEB; Tue, 31 Oct 2023 09:32:29 -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 A1F3B66073B3; Tue, 31 Oct 2023 16:32:26 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769947; bh=KjApYJIBwjQar3zDS5eK/9rcHF3+Kx68u3lDScmGVYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FtOTC5GWR4f5FO69bIDlQ1ZIEgZPN8FxUnkEd1By7Slbd1hVXVoV2sBoA8plwqqzK g85KEYm9ASUnea0DWrUioFUTi88B+kV39kozMhkhOobLYLN93zPlBFADfgMdbYhwC9 ks6EBIpXnX2BOfn+KVX7fBXgQwl+FaSyVscGxVbeCefGWTgHTuosDD772LmP3HJJQz qU63DinLbmOtO1BA8x/ObWs0H1Ymqqv3ciCBKRjoo9cVBo8ksysjhb6xsjTziNoxCT YdsUSdAzQOi+BCK1ZTDxfcKyhq6iKaqpgOFiW7yxhgwFXFFgbTxUWxg2ngxgkRp6jv V25w2TkQzYmuw== 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 v14 39/56] media: usb: airspy: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:47 +0100 Message-Id: <20231031163104.112469-40-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=-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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:35:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289596960761665 X-GMAIL-MSGID: 1781289596960761665 |
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>
---
drivers/media/usb/airspy/airspy.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> > --- > drivers/media/usb/airspy/airspy.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c > index 462eb8423506..e24e655fb1db 100644 > --- a/drivers/media/usb/airspy/airspy.c > +++ b/drivers/media/usb/airspy/airspy.c > @@ -482,12 +482,13 @@ static int airspy_queue_setup(struct vb2_queue *vq, > unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]) > { > struct airspy *s = vb2_get_drv_priv(vq); > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > > dev_dbg(s->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(s->buffersize); >
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 462eb8423506..e24e655fb1db 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c @@ -482,12 +482,13 @@ static int airspy_queue_setup(struct vb2_queue *vq, unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]) { struct airspy *s = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); dev_dbg(s->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(s->buffersize);