Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp247465rdg; Thu, 12 Oct 2023 04:47:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEkjcnDPP1MqTnroSQxEuQWH7ojfrs8wjPPuwdbC7dHhYNogAEDWM5mMeNTjQophPV5Gkn X-Received: by 2002:a05:6a21:788d:b0:16b:79c2:877f with SMTP id bf13-20020a056a21788d00b0016b79c2877fmr16673336pzc.53.1697111257176; Thu, 12 Oct 2023 04:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111257; cv=none; d=google.com; s=arc-20160816; b=G/41UHOHWVeGVqA3zmYb29BDOr1lybAyZs91a+CoDluWyKLcVqJmx2n43jUOAWnoD0 IrQ1n7NPy+FWfCJUWTtQx6S+wBDryyH49pV7Ezgr4UWYGgQsZGWX6BdiC2jWIyXTUHZD bHK6dU5c4CM3MvzRM0I7loVCPPhzazs5/uOZu12aGCXGZu/Wxe7NQ4RZC3UeWSDsyD2E 8zY3EJCeDrJUCS5cbpYG2vB3z1a3TLNtJxTCfc7COoz+Y03ee3sVkr3BW1oklYHNyxNQ 2OW9sjO9YGNaiELlFJ2OGQgUOo5GQaEtARenA6ItSYBiSvHGWG74KppG2sGD+uPTJmcy DfUQ== 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=CQMe5k+Loh3Shj8fNSo9spwZuKtXp194mTPiUqm2HQE=; fh=YhVWgOX82fKLE5M+MoEX/CwrdcPd8SQ1dctjbZBk3rU=; b=DZPo78e8AhG2gXAWyzpbw1Zpv9oN/YuR++y9ehGpRhFC65pr1EnuViLM72YS6Cu32l W8KghoKTovGM+mvZ0hxgTgTBI9DSMvq9tQ4N+zK82pzFLTH5q7rN2xLyDOx2YNbY7sxI hc+KZsA1V+sbMfvKLPRz2j8oCL9kEDF+thPKjro2vVRKCV60IOlatCyRS8auQghqX16K YNQpKpVAjjjJofOeNnPJI0xXhcoEMNxUKEQ166W88i61tTJrebfOUOI2xhAoqO7r5l++ b7LsvRuv5x+5jvoAoe5j5mu87dxiP8HDnu+JDIUQKzAdx1qrEU+xKCAzn/yDeQpO40Ml MRvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="ZRiZjv/D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x8-20020a170902ec8800b001c74ae78c7bsi2189810plg.377.2023.10.12.04.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="ZRiZjv/D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 868B8822CC05; Thu, 12 Oct 2023 04:47:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378618AbjJLLrZ (ORCPT + 99 others); Thu, 12 Oct 2023 07:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378367AbjJLLq5 (ORCPT ); Thu, 12 Oct 2023 07:46:57 -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 0AC45B7; Thu, 12 Oct 2023 04:46:56 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7ae7:b86d:c19a:877e]) (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 8199B6607355; Thu, 12 Oct 2023 12:46:54 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111214; bh=fUpiGVSgUDEJ7+9Xx6wCjlwiYUUChFkfdk0Qh3AitbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZRiZjv/DeBap13OYizL3LhT/ze673fBiKlHtq+PvCJYQfuUOALJHLB3B5n47IrbM3 Lx4GyeyrfH5Pev4+MXFCr0vIePnxw7mKH9O4jCBh42IS8nRBs6He/m8wlFZHqu1fzJ NMYHlL/vf0U8Vgsfzqjr0dDXKyYeF5HkX0/CPnZN9bwzxCd6eBe9iG5nTekVGtaRBD xOEQkwKKC/2J03T7Fpj+w1U56p+VblzkMaM4cPcVUiMdr/n7xw41uzvoyPbXSxKUln M98kVZ9dopqVHbslRwGWuKro2f4G7YEzBnbzfht0RcCTATCk/x4SnWereHK83JpFsJ 7IfkroYNQq7Sw== 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 , Zhou Peng Subject: [PATCH v11 10/56] media: amphion: Stop direct calls to queue num_buffers field Date: Thu, 12 Oct 2023 13:45:56 +0200 Message-Id: <20231012114642.19040-11-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012114642.19040-1-benjamin.gaignard@collabora.com> References: <20231012114642.19040-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 04:47:36 -0700 (PDT) Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. Signed-off-by: Benjamin Gaignard CC: Ming Qian CC: Zhou Peng --- drivers/media/platform/amphion/vpu_dbg.c | 8 ++++---- drivers/media/platform/amphion/vpu_v4l2.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index a462d6fe4ea9..940e5bda5fa3 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -87,7 +87,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) num = scnprintf(str, sizeof(str), "output (%2d, %2d): fmt = %c%c%c%c %d x %d, %d;", vb2_is_streaming(vq), - vq->num_buffers, + vb2_get_num_buffers(vq), inst->out_format.pixfmt, inst->out_format.pixfmt >> 8, inst->out_format.pixfmt >> 16, @@ -111,7 +111,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) num = scnprintf(str, sizeof(str), "capture(%2d, %2d): fmt = %c%c%c%c %d x %d, %d;", vb2_is_streaming(vq), - vq->num_buffers, + vb2_get_num_buffers(vq), inst->cap_format.pixfmt, inst->cap_format.pixfmt >> 8, inst->cap_format.pixfmt >> 16, @@ -139,7 +139,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) return 0; vq = v4l2_m2m_get_src_vq(inst->fh.m2m_ctx); - for (i = 0; i < vq->num_buffers; i++) { + for (i = 0; i < vb2_get_num_buffers(vq); i++) { struct vb2_buffer *vb; struct vb2_v4l2_buffer *vbuf; @@ -161,7 +161,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) } vq = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx); - for (i = 0; i < vq->num_buffers; i++) { + for (i = 0; i < vb2_get_num_buffers(vq); i++) { struct vb2_buffer *vb; struct vb2_v4l2_buffer *vbuf; diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 0f6e4c666440..87afb4a18d5d 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -439,7 +439,7 @@ int vpu_get_num_buffers(struct vpu_inst *inst, u32 type) else q = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx); - return q->num_buffers; + return vb2_get_num_buffers(q); } static void vpu_m2m_device_run(void *priv) @@ -587,7 +587,7 @@ static int vpu_vb2_start_streaming(struct vb2_queue *q, unsigned int count) fmt->sizeimage[0], fmt->bytesperline[0], fmt->sizeimage[1], fmt->bytesperline[1], fmt->sizeimage[2], fmt->bytesperline[2], - q->num_buffers); + vb2_get_num_buffers(q)); vb2_clear_last_buffer_dequeued(q); ret = call_vop(inst, start, q->type); if (ret) -- 2.39.2