Message ID | 20231031163104.112469-42-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 t15csp365991vqg; Tue, 31 Oct 2023 09:37:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVxKJC/LPD7PjdCVf0r6EPUIFWDJIE9a7aFQKOTy3otHI4Afpn92dbBWBJTTYjXG4rnz3H X-Received: by 2002:a17:903:3003:b0:1cc:2376:5508 with SMTP id o3-20020a170903300300b001cc23765508mr8113330pla.34.1698770233432; Tue, 31 Oct 2023 09:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698770233; cv=none; d=google.com; s=arc-20160816; b=ufwvcGIAZi7ULDicrcqwP/vBpnKSLSMcnUUlho8Ujs9DQvzP0RAAyZSY+UGhTNNH9C zW4vNNtqrQNJ36EnnF/MQHRWgaZXmKqfId66gH9hdgSTD7A5HfaOfVrM7C3hgF8ybfgn bDgEZuGJJE+7o8OrKpilWI6STr+6PRK6xeXitidYROT1Aa2nWHurk8Avg7WVSWl8O70C pFvAKUhHmgEA7eLEA+exxZng4yFzmFwnmW7FXCTnUimeRz7kU8311xpxmO6rA1ldNSLn FDiLMUXpVz0s75KPPAGy4I/sTDq64z+c612Zoktv48szipr5R9FQnoYVGgM8xacHU7J3 9FEQ== 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=5Q7ZrRRCLUX7MQga/2Jp1mB9ALimtGx2XcWFCRhpmxI=; fh=p0AH8hgimiy85Lh1cXLIqpi5zFbeLa4s8fsQNMmUBzM=; b=YmumOx+JDgreFeYFY/KY4oy8sckGrDSjosgcbTCz3LdEnte6K3OjTTy7JsU0gG/oIL HEuX7WJwYDawWkW2rSJrpbeaC9UPuC7nglZs6/HSQv241nW671RAsFPRjwBZmjmlzNsd h9gU3NcSxY7bmGnlXJKEMTpX5L72Vl06QE3vp+RtWS4L4TfzUBUIeNzi5b/w5Y0FuOJG DgwK+kol+XbEkMOvGHOyQJVq7mQUrt/qX8r2odXOUk3dHmLrl9+necnMERH+ZFbkqLpW zta+T9imwaoaJMptPaM9HvZC2dBvzaAgM1vNbbt4a1khokualJ26SZRJ2Ai2xrMDbldb s8JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ZOF6ma69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id f17-20020a170903105100b001b9be3b94dfsi1160399plc.268.2023.10.31.09.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:37:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ZOF6ma69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 5CEB98033DF0; Tue, 31 Oct 2023 09:37:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346678AbjJaQgP (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 12:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346556AbjJaQfU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 12:35:20 -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 531521FCE; Tue, 31 Oct 2023 09:32:34 -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 AE49E66073BF; Tue, 31 Oct 2023 16:32:30 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769951; bh=nxe8x/V/1l6XolEQlUJAmFRKBPmiBgQL0drOV0CYbaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZOF6ma69mY9buv7hJHLR0h6Vl15crg0ezaW/yPcLElvpQmVaXL1CxvEPuaTl4De/b 140wp3zNZzbEqJcCnTI/5FaNJ6mDQ2GhO38HlRopPj91Vy65WTB78fyeC9OFjWAEHb XHfElZyfpBl8ApUwwkO2AU3rDMGrUejL2E4XcJKb3UWzOcibTzPrSVHMhkwa5PNnYu luforDop+1IOhqUw62ntXoBa1dXHFoCOjAHTyp8MwA44nA2ZCqnrK+IlBIoDubDewH f5wA1U5SU5bMb6lWm2E/lFh2LYZA0H7fyZNSDOgBueT5qEefp0b1h7wxd5zEDWEhOh H2GqxRVgW1TrQ== 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 41/56] media: usb: hackrf: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:49 +0100 Message-Id: <20231031163104.112469-42-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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:37:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289696514937801 X-GMAIL-MSGID: 1781289696514937801 |
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/usb/hackrf/hackrf.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/usb/hackrf/hackrf.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c > index 3e535be2c520..9c0ecd5f056c 100644 > --- a/drivers/media/usb/hackrf/hackrf.c > +++ b/drivers/media/usb/hackrf/hackrf.c > @@ -753,12 +753,13 @@ static int hackrf_queue_setup(struct vb2_queue *vq, > unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]) > { > struct hackrf_dev *dev = vb2_get_drv_priv(vq); > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > > dev_dbg(dev->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); >
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 3e535be2c520..9c0ecd5f056c 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c @@ -753,12 +753,13 @@ static int hackrf_queue_setup(struct vb2_queue *vq, unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]) { struct hackrf_dev *dev = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); dev_dbg(dev->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);