From patchwork Thu Sep 14 13:33:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 139713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp497601vqi; Thu, 14 Sep 2023 10:11:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8mizCWtJbzJ5+3zttRNRE9diZZck2RJYKOHY9vmNXtanlC+O4Ov0XjtXoT9ZMQL3mkTST X-Received: by 2002:a05:6e02:1a6b:b0:34f:7e36:5f8b with SMTP id w11-20020a056e021a6b00b0034f7e365f8bmr7593921ilv.25.1694711473093; Thu, 14 Sep 2023 10:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694711473; cv=none; d=google.com; s=arc-20160816; b=SeWcgQQiJ3aoQiq7Gu22eBq5CMfZN3DxMpdOwR+inz+dWpdvJD+virZpB1i6Vmm96y x5EPxn0ZsEGv8Enr3qNM3pISXtR5T5xfH6u159c88XyyBh2xqTuZIh/wCrbDvBY4k+cP 1pygh7hZape4rBp7s/Gje/0mX4YGMcqNhZ/tEkT7lc32w7sEbbXd32HtwlpzyrxAd3ii 1VhEGqRK4xJ2lWriU33XOuPWMkloWDrkZKXRGm5mlMbGNE1saUtktBwbmXZlleAyPmK4 eWUxDhSFEHk2IkO2/fHBQ4UWkq2JCUTpna2fobQd6mZRdUigpY8kluUFkyX3cEoAeAKJ 8SkA== 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=P7XtX/sqfuIkG3FCCUjhem5eiV5Jj3Kq1GFr/mKplDA=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=M+6zyVsc45+XZx6jXLIlx5R/t50h92Kfp8hvwG1h+VgfC+y4eIGEY661kExOxNKcvv XCfBPQD356nJauZ86giGiAUvpNrJs7DRXMduyr85lUnHHLLEkVXKvQjZoJIvt7pfxh8Y tuFFjls5UP2E4W8YHvdtHjvM6776SHjcicKQflP+6G22Im1IqEpR66ou4GY6OgxsaRvZ F1mSrFdzApiurO7DWqlyrWFJGRbO9j5+SIjr+dOqj8nH7f09D9TK8J7O5URD3o7bmwSe qs/pM/amn3Oyp4k8IcxEKZZ53Gp6miNslWt+V2YqdfwS0tNRQAkxoKQXQjCa2BmtyxsU 86JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NyhJ2dwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id n125-20020a632783000000b0057762236e02si1908961pgn.149.2023.09.14.10.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NyhJ2dwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id A8C0E80FFDA0; Thu, 14 Sep 2023 06:35:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239756AbjINNfW (ORCPT + 35 others); Thu, 14 Sep 2023 09:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239667AbjINNeh (ORCPT ); Thu, 14 Sep 2023 09:34:37 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DC2626B9; Thu, 14 Sep 2023 06:33:51 -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 7C979660738C; Thu, 14 Sep 2023 14:33:50 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698430; bh=qmWuuxIVaok5VOxLNiFLwq+P2WJDPc3grn0IjW7G8J4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NyhJ2dwtPDfal3GMOCQlY4W+pMVniX4P7qIMMF2pK5OTiWXQXvoNHek/ChDKkrmpE tusvef3OC6i+UUb5ZwxTMrrzLxp3qiPcUN0NVdy6atRpaKm376uwRMwlO1NKwsPND2 GZw7MoUDZe9LMrutMBUBRq3tTA6NQThZ4mynhxaJyJWHpirnQ7/VheDKXdUfC9rcyE rgd/MMe+25F9DYK57rnlmNOLCN+0RkhbK/ELmAdQ+SAHxGOkS9sCQFzcxPhdF/MvSn KTDjfMqBcc+M57wKPUWxiyU35uVlabRPlaD505PVFEI/5QqnctZkt0piy+vPOdnCdG n4JHeDZlhgzLQ== From: Benjamin Gaignard 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 Subject: [PATCH v7 37/49] media: usb: airspy: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:33:11 +0200 Message-Id: <20230914133323.198857-38-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:35:58 -0700 (PDT) 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777033777199201716 X-GMAIL-MSGID: 1777033777199201716 Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. Signed-off-by: Benjamin Gaignard --- 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);