From patchwork Mon Oct 2 12:05:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1391437vqb; Mon, 2 Oct 2023 05:31:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGE+3o4ct9rbPnBbWWr5WhXt3iqv22RDrdelWDJ7tSk2kfMxK9VVFdGBCqi3e1KTkHiowHC X-Received: by 2002:a05:6a20:4283:b0:15c:b7ba:e9ba with SMTP id o3-20020a056a20428300b0015cb7bae9bamr15090949pzj.0.1696249866811; Mon, 02 Oct 2023 05:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696249866; cv=none; d=google.com; s=arc-20160816; b=LLrTeZwyKgoLMLfxveS2HnhfsZp/1es5BB3fTycuQLjoPr7kSEyVw5jnw90dcZNLW8 SiPsMgwBIsBhS+bDhF05tm4XRu2dHwFQcr0FX+SyVb1RvNsI9NXq9QxmL367gDsJcZ5a sAXCrZ6Wdwdx3ydJf0NPJekh0+DLcHjH14Y2fyvx92MBWDStUQcpxinRkCEi0emaI5EH Il7BGYcsi81BLQfALnea8oE7Wf7mMKR4TJbfa46xY90RTAdzTS5pV3cHZhHvFPNr1fUs TIK8vti5ar9cZhv2OtIvC8X3Z/kcfPfYH/xrfspojbY48pnV9dhj8txX8zVoiBFPDnqf cHCw== 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=AswV3wv9j4+AV5DLFt6qUTx/hmlnxbIGATF/n2ZTmQM=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=XRpUekRFQKJI2dOjaMSYitkSAHF5MGmWYIlhpZDrGHuC7eNMp59ago/w9kM0c+NTI4 fdsjZWrcHI7tq8Z83EsFdPnatu2l5y+jwUPDFYDpy2g1BJlQ2gKF19G8UIxDoI4xPwoX agfot7OQMQml2LvSdS8Jl0TSuGyGNmZXJZwLukiYPuGmCf9oPdTgK9Ed1YFNd7FaXacQ OfVPBk4lcViCLWVo8IBIwNxM2rWtnm6nHZo/5L4+V+eCrW+eAXOJ6XIe+QLOeWaZ5Pgz 1bWR2kj7MQySRJc8Mm/MeUSbUBGG5m6Hm+EpkLa6yclSeKdMJQOQp6X/GCe+0fEtJ0jb VFUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CnzI5EmZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id kg3-20020a170903060300b0019c354055d0si25447569plb.304.2023.10.02.05.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 05:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CnzI5EmZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 5692F806083D; Mon, 2 Oct 2023 05:09:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237334AbjJBMIU (ORCPT + 18 others); Mon, 2 Oct 2023 08:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237051AbjJBMGw (ORCPT ); Mon, 2 Oct 2023 08:06:52 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B91BE1; Mon, 2 Oct 2023 05:06:43 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:9537:67ca:c85e:d0ae]) (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 920F06607368; Mon, 2 Oct 2023 13:06:41 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248402; bh=GZZRScc0G+g9MpmVo+b1q2mYVPFLCSqMx1Hk2ETt1Vc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnzI5EmZWPH0C/k47H1uHc3OmkZL34PD3BEWk2+K+WQA6OEXZQZrRSwxALkZEc+Ww Tw/bgpb0vH0rNmH/KT7l5JnhXzYgemFib3g6q5Z6JzDHULIEbe9CrfZfw42pnULANJ WgqjVNTAm/3+2DqfQEOwExXb9pIwsPc+aqq1fh7NxMA1mMsYwxEuFnVegIlVrQRL/S aA7p/EgmLcSe3nEu8r16DNZSqtmjRwS/3AeYmjV6BBv/W6GCXDK030pXc9Uz94stbK QGNlAU+2KSBllTAcXhyRRHlFbahrLdiNjVnVvU6Nbx0jGxIDPVfgiIh/rIULGZFDGc Eq+WOq0N173ZA== 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 v9 32/53] media: mediatek: vcodec: Stop direct calls to queue num_buffers field Date: Mon, 2 Oct 2023 14:05:56 +0200 Message-Id: <20231002120617.119602-33-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002120617.119602-1-benjamin.gaignard@collabora.com> References: <20231002120617.119602-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 02 Oct 2023 05:09:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778646900296467306 X-GMAIL-MSGID: 1778646900296467306 Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. Signed-off-by: Benjamin Gaignard --- drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c index 04948d3eb011..8c580956b905 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c @@ -923,7 +923,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) mtk_v4l2_venc_err(ctx, "pm_runtime_put fail %d", pm_ret); err_start_stream: - for (i = 0; i < q->num_buffers; ++i) { + for (i = 0; i < q->max_num_buffers; ++i) { struct vb2_buffer *buf = vb2_get_buffer(q, i); /*