From patchwork Tue Oct 3 08:06:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1929185vqb; Tue, 3 Oct 2023 01:09:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2R8BXvHhU93r3M/NjwblBw2GKx3Ayli2oOkY1G85nUq4tN6mqksYNAZc9W+rgyYus3CqG X-Received: by 2002:a05:6a20:1387:b0:14d:c05c:6620 with SMTP id hn7-20020a056a20138700b0014dc05c6620mr12713858pzc.31.1696320597418; Tue, 03 Oct 2023 01:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696320597; cv=none; d=google.com; s=arc-20160816; b=s1JnvKm7HbbqTMeqKzVNyT7PbVW+PHuHHhGC3cFo9SlkLUseNc8iCfYgKhatC0+WcI T0vPCjhpiRBhckOhZYuRm2XrKo+fro/DK000ZsgxtzhgrHtt17KA+hemffW1i5Ebp5NY SDVBO+p2owSricKdrO1PSBuXfYIK9Il0CFJs0ZVEC21/+q8HTWmnDoTKR0Hnkf6vOIIE HWZb2cHex9cbnEurDt8kYc5hqHPIpezzRORWM/zU00L0D+MOcoFblC8XuzP45GPFk3/q 3GHHQr4KSnKw4nEpAkmS/0l3O/rtRg4hPsn/R+N5sHitf5SUHXP+rsuP0qtJMg/4SG7J M3Bw== 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=Nv+laEtgXgx7GQGb5vu27MK1wy6XGoa3DVnvbIWhVo8=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=G8jo9cpSNkfYEFYDJnX6Q+o5B9X/XSfqG4ds4clwZ2W8Ks20CVSf/y1DkbaLvevRFb bH04Swm9K6q+KmZIAC7LN78i1DoIiO8eD8XQiGejJy7bxo9HMPQIYg1n0I2aEbE/M1Xa 8NXwrOMSEXPT/xeI8PPeCeLNOq7qjUOeJWVpvcpKrYMT0ynAvLSXsKsSr4vu4oMQidaY EEp2ikM5hbqQhC7WCTl/Txfdp4OPGSgbdlcVHp1/KP3Bwb1V3Js4zRwKugjbMqr1RSeq EGeD6nAv3DbqoFeN0JFjHor6s75sv8ws2LalSlfMPwlvWuwLmjxhisSur0HCgIoESWBv zzKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cc489ryu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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. [23.128.96.32]) by mx.google.com with ESMTPS id cu8-20020a056a00448800b0064f78c32b89si955954pfb.95.2023.10.03.01.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:09:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cc489ryu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 9E21180F668B; Tue, 3 Oct 2023 01:09:45 -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 S239316AbjJCIJT (ORCPT + 18 others); Tue, 3 Oct 2023 04:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239472AbjJCIHh (ORCPT ); Tue, 3 Oct 2023 04:07:37 -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 A073F193; Tue, 3 Oct 2023 01:07:31 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:b6df:b784:6a0f:8451]) (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 0B6EE6607315; Tue, 3 Oct 2023 09:07:30 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696320450; bh=39A9g3IYIYcRCFD80WoAPZ3565fBRND1EIIP73qIh+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cc489ryuVXN6cO6oh7m3jteFhDZpIUSYC7bZOSDUgfwL33wSEveh6eRqn15Ib76dq UhIr+9IFW8BGajoODCoPk1+dEACei6cuwSbsMNKmAY1IMB7WWadUSzyIoTnXPHF/AT Zk//qkPrSHqJtAoEJcvDSY0m/EeTcQXFPwebaCLy8p6oioqiusjE0fOhsxXhNoCXzW dkqmeaRr1UeYcyH0cB7DDnbGqNj+iQWXgPJXpjKJRGsz52mWmlJ3ZspVvsdJk7cV5H X4DFJJBHE1AyQYLCsgjaFiORmDQ44Hs7+ym1QjuH8AwsDlGKk4UNr5Jz2KwHMHNxJ5 ws1cGmNMaY3Ng== 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 v10 33/54] media: nxp: Stop direct calls to queue num_buffers field Date: Tue, 3 Oct 2023 10:06:42 +0200 Message-Id: <20231003080704.43911-34-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231003080704.43911-1-benjamin.gaignard@collabora.com> References: <20231003080704.43911-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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 agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 01:09:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778721066529035452 X-GMAIL-MSGID: 1778721066529035452 Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. Signed-off-by: Benjamin Gaignard --- drivers/media/platform/nxp/imx7-media-csi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 15049c6aab37..4c467fb82789 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1245,6 +1245,7 @@ static int imx7_csi_video_queue_setup(struct vb2_queue *vq, struct device *alloc_devs[]) { struct imx7_csi *csi = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); struct v4l2_pix_format *pix = &csi->vdev_fmt; unsigned int count = *nbuffers; @@ -1254,14 +1255,14 @@ static int imx7_csi_video_queue_setup(struct vb2_queue *vq, if (*nplanes) { if (*nplanes != 1 || sizes[0] < pix->sizeimage) return -EINVAL; - count += vq->num_buffers; + count += q_num_bufs; } count = min_t(__u32, IMX7_CSI_VIDEO_MEM_LIMIT / pix->sizeimage, count); if (*nplanes) - *nbuffers = (count < vq->num_buffers) ? 0 : - count - vq->num_buffers; + *nbuffers = (count < q_num_bufs) ? 0 : + count - q_num_bufs; else *nbuffers = count;