Message ID | 20231019125222.21370-42-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:2010:b0:403:3b70:6f57 with SMTP id fe16csp361327vqb; Thu, 19 Oct 2023 05:58:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5h8BgKWrQ2nsO/G3gTJyFlNfQWf1OXZZHWi2BdH0W/Oxp4VQpmsRRs+AUbX2Z5ciZa9xE X-Received: by 2002:a05:6871:1c5:b0:1b3:8cfb:78c5 with SMTP id q5-20020a05687101c500b001b38cfb78c5mr2307225oad.34.1697720289761; Thu, 19 Oct 2023 05:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720289; cv=none; d=google.com; s=arc-20160816; b=scLiuyK7CrkcQ5bvfDdDMajHyFo8mYAmiD8j2ZkbqttzayAMUUR7YoJvUuPSbFpTAQ c7ILUkWV8cGg4JKzZfxSKV29srfIa2LYItcbQedVOzKLnB2fsM32od0sm4KcsMjSvs5P 0s/6FBVR4kAW6SVgi2HjEViL+90KOEPYTtymNE4djZvREHHDYgKXeqJR2OibpZ8LzbKg g3UqlJj0Zn3u7InqRgG57g5yMk0FA5pPQHMCz67pymM/4lH3yLZ6aMUIDnYVtYzx23Lv YwxmVfAdbg+mw4uzzHMDqbqEyKI5W/J7HUW2seTewFxbsiYAwBFXCMaGSUCqnM3PDKXO U8yA== 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=v0lMiLrkVE35yZdqlNXxdfU3SMgZwttyHonI+2Jp1FEuIqiRtCbe6VRsZnv4664Byz woY8wLhv6rENAKADhWcDmZ1KltG0QWNiPQo208GCtuJSWxzRLZIga8ON9eWozdGGcxdZ WaO9bvG0heKFrkfHuBpQz/1vOn/OtEfD6hO8LW+iBjMglpISgv/yojpIeFy9xQGRk/Wy YdEytekWjn+lwKBfnHw7dWxRb+eFmw8LzSEaDBTSNLySA868ccr/H3crlK+gSdDYXora bd7Xjob8enGz7X5cWg4XRkSlybK1QJFk4rc1oOHkJO05aKAsP6WAeadKnymSxIBqQuDI BxqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NdK5aBWy; 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 n8-20020a654508000000b005b34179728esi4432719pgq.237.2023.10.19.05.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:58:09 -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=NdK5aBWy; 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 D8E3C8122F0C; Thu, 19 Oct 2023 05:57:54 -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 S1345883AbjJSMzo (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 08:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345613AbjJSMxm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 08:53:42 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFBE2D6C; Thu, 19 Oct 2023 05:52:54 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:ccea:1fb5:34eb:239b]) (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 018E66607384; Thu, 19 Oct 2023 13:52:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719972; bh=nxe8x/V/1l6XolEQlUJAmFRKBPmiBgQL0drOV0CYbaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NdK5aBWyfabr1RW/jjBwqQTxhdaELhBbiycWFPsGous3728mTSqIx/Kh+QUSaKSzV IyFmLQgPHSLU5DUGq6znakUf8WkESd4TLCYVayhHMTgSd6eI0zEGsmlo1SehDgHZ1z XFIg/8WQ6cXLjCdowQS+Q/2UcHAkbLUgu65RRGnvDdmOua2wuAv7pLH5c4Jfz+iMcH 2ZJfLecKts54kV81qruNRYiH6bGUasmwQXZs5rZt6lFxvlThx6usG5W3gwgCkpxNt8 vdbtaUtHiQnVpAk+PUjQs/uAFikNmL0Xx73nofVT7JaNel8Bj5DwQ82Vme1sbXjC/G TldwfP1mlOVVw== 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 v13 41/56] media: usb: hackrf: Stop direct calls to queue num_buffers field Date: Thu, 19 Oct 2023 14:52:07 +0200 Message-Id: <20231019125222.21370-42-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com> References: <20231019125222.21370-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 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 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]); Thu, 19 Oct 2023 05:57:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188750149838097 X-GMAIL-MSGID: 1780188750149838097 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 19, 2023, 12:52 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(-)
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);