From patchwork Thu Oct 19 12:51:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 155520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp359854vqb; Thu, 19 Oct 2023 05:55:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGYQqULDHUWt7Hm6Dajk2KyWpxEKtB1QjspFdlR+8vYjXvLvks8IIfT6f4K+jbB91k+z9p X-Received: by 2002:a17:902:e5c7:b0:1c9:aac5:df1a with SMTP id u7-20020a170902e5c700b001c9aac5df1amr2477819plf.51.1697720112591; Thu, 19 Oct 2023 05:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720112; cv=none; d=google.com; s=arc-20160816; b=dQT2Vo/YNbQx+rH/huzRUsZtMSipcyLMVkftZwIU/oy0xLUMawHQztozkoSVmFfLHd LhzFziojkJUEKLrBdTQ7EqKCRq4bU23/mFCBapMNVXgeFuIZINqEe+1e/f+A3y8GHj8Q PY+A8XTEWkghviic3V4W9OO/H5Ir7TLwHSwgrWcpDaTTHSgFLbPXfsDNcy9I0QAGaoqj 5IZ7vGRLbVVeja4MZayX+WajugaP1ADCH2FMJ7yiVQf4Xmk1Tu0vwNpElFvqMT7myIsb KwD7Yyxd0FC9QqwJpkeQs7wl6OJYiTj9pj3IaCYo0a4R2OuoGNRJuBG7K5CoNVNNt0Zr tuIw== 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=h6Wt5ZXH7wEpvAHo+HItmpVGbqd9IQOis/K3NFElIIY=; fh=+NS11/YTnD7GglrGYsYnSnUacC2YXoJUirkP5/1okOw=; b=fI9eK6HbzxKHL3fAjbYCG2rrSyZd4LB617J+kEfa2vX6mZuK2l1upGm2QH7MEofyRi o0SKIxBnTP76wrSlX86hGW7WKL4QQjKqoJ2dxmhbn7GMVykvGFOEpy1K9gxaoRcrE20V QB7VrZHcYXLzBfY8TRbaNCih0tj9dbFT3x8HRXoqX83yTrqiGEiZ02KzD/2ve7y/Pb// T4kaooAszIjXvxIo07YG98upJx4u845TMjpANfj2Ks8dcW3QueFXjpkdlWQC2xoREkbm T3ygYTBdMYI5xnBDXj5RKj9lkeJctythLrsPG/aEvAN6dmG7HjGMJdIM8D37gq6GilDB gYuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DTNGc1ii; 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 u14-20020a170902e5ce00b001c32fe6cdf9si2179340plf.386.2023.10.19.05.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:55:12 -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=DTNGc1ii; 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 5D700822B2EC; Thu, 19 Oct 2023 05:55:02 -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 S1345972AbjJSMx1 (ORCPT + 25 others); Thu, 19 Oct 2023 08:53:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345755AbjJSMwj (ORCPT ); Thu, 19 Oct 2023 08:52:39 -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 5D7AB130; Thu, 19 Oct 2023 05:52:38 -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 B6B7F660734C; Thu, 19 Oct 2023 13:52:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719957; bh=LFTEg/R/Wor/QN2odw5Z+gHhYekb/C2BteTgt/nxpjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTNGc1iiCyHnMzVXBjmWdOhVXbh9Q+qh0aZx+rDjQw8dNkm/dc7AKnsuotx8dBZJ8 NF0U1uCUdlYotWfJsbXcE5kZHxKTj/7Dl7s+qvLAxF5OLA2UoSgLD5bXCo+Pign29B AhOLH5i2uCQb5ZrhDX9HRLF5v3XZEcTMvtrw8plKTWjZnYVAJlsTZCS6V5l+MLu7ja S/VKJCTsj7K51FZmqJGdX2UiVNj9fxrVv6soSPpxTqjTvdWmTtgHmMyJq6q10H0nLT KFgRhPN463QQlOwdjRYB1acRAMO8GuPhI/T3k+nQTCkfRZ88wtemuUQg7DSplY7+bx 6HCx3kNvCgb/w== 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 , Bin Liu , Matthias Brugger Subject: [PATCH v13 12/56] media: mediatek: vdec: Remove useless loop Date: Thu, 19 Oct 2023 14:51:38 +0200 Message-Id: <20231019125222.21370-13-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 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: 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:55:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188564503575881 X-GMAIL-MSGID: 1780188564503575881 Simplify code by removing useless loop by using video buffer index. Signed-off-by: Benjamin Gaignard CC: Bin Liu CC: Matthias Brugger --- .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c index e393e3e668f8..69d37b93bd35 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c @@ -1695,13 +1695,8 @@ static int vdec_vp9_slice_setup_core_buffer(struct vdec_vp9_slice_instance *inst return -EINVAL; /* update internal buffer's width/height */ - for (i = 0; i < vq->num_buffers; i++) { - if (vb == vq->bufs[i]) { - instance->dpb[i].width = w; - instance->dpb[i].height = h; - break; - } - } + instance->dpb[vb->index].width = w; + instance->dpb[vb->index].height = h; /* * get buffer's width/height from instance