From patchwork Tue Oct 31 16:30:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 160185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp363182vqg; Tue, 31 Oct 2023 09:32:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmxgMrYq8Km7GAXo360/uuwGXJcHRFNGqV/ZiJcuLyqFkDawT7+9VwrRyNVYc6UIzOMbOa X-Received: by 2002:a05:6a20:ae25:b0:16b:bd0f:ad0d with SMTP id dp37-20020a056a20ae2500b0016bbd0fad0dmr10137679pzb.28.1698769953450; Tue, 31 Oct 2023 09:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698769953; cv=none; d=google.com; s=arc-20160816; b=NTLIlzK5qi75AEb+3b48j2vpnQTjVE1l7fxzYxPDKvEdNTqoDpvKvkQ5sUyXB/ziDI Kg7juiDZuna5OM1//E6bGY/mVMQlEeL5h4kWEG/sydDVmVMaJ/1N/UhY21l4+mAND5VC hFqPKNbwD8uGPAvQ5dqdmWchY5nb/ErSBNft76dcWx7aseNNezML7aBsUnFHr95eyhJ+ 7Mu3EqH8492o6ig4IgIxdUQ49q7Q16B3dYsmGuPk7hYlyPYGF9RSWV5ic4wuZ+1/+OSE f+GbR+zdkTepIJSXvlqGyaX72hGKT5QnreCOAzWaaBa8Pu2p+WOx9TZdMB6lxgingCZQ BBkQ== 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=HYvTV3xdsgIy9oaOGFtuEQjvzKIipEeaUEi+JtbvV3iRkDqQDLrWaBpfceXK/xskXv MNH1p6SrTE3Lmrc1ni61EBaQbdddQ+Au29MjEmHA12mXT+TQpIjilfjznwr9FuYLOxXg TQeIPZA8U2KfLTb4atRuPPtapnm8PvY35sBUcL8Lra5X1Jx1RpskYNsqL8bOxihB/HV1 GmuVUTH15aFpFSKU6CLdE3KszINZZtsnJw0UBTXUooJKHB6tZ9knqHBzl9DqZTMOKeeC CZBQKC5g/5Zme2vu7m4aMD53bLr4KnoB3XNf4di+tbP+/w4KNAM8INagZyxFDQjqLhn3 QtEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iEux0F7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l73-20020a633e4c000000b0057c7d7036b8si1254001pga.389.2023.10.31.09.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:32:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iEux0F7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 40DE8801B91F; Tue, 31 Oct 2023 09:32:30 -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 S1345399AbjJaQcO (ORCPT + 33 others); Tue, 31 Oct 2023 12:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345368AbjJaQbp (ORCPT ); Tue, 31 Oct 2023 12:31:45 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DF41138; Tue, 31 Oct 2023 09:31:33 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:c562:2ef4:80c0:92f]) (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 CB97266073B9; Tue, 31 Oct 2023 16:31:31 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769892; bh=LFTEg/R/Wor/QN2odw5Z+gHhYekb/C2BteTgt/nxpjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEux0F7j/Tf+uG2wOzbwYug2nV+XNbHURcjCsUEJITRiyTA4yyfwuFUrL3DYPROyL XJjB0h2DvfZXFoZpH/N9kVmicKAFPlM1fDERaxG5829I1TaM0XaP2aSquf0L7RGrcZ WD5oBxNl6lROj55iaDOX6ueAHWXNPE6Ni3mbFM6K3ZNC/nPLeDcHg96/IP19ARWNMB SIRlyjzN7wnDm+IVwFv430XuW3nu0Colcir2uetLtUFkb79qpgK27uD+PKNO8XMTBV lLCtPLmCyiwD6EXw2Yy0DiWivhZa/oGN5pszoxhaItELXwurbav/nG5j8SU43E+Ieh ugMfYDzwh/EBg== 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 v14 12/56] media: mediatek: vdec: Remove useless loop Date: Tue, 31 Oct 2023 17:30:20 +0100 Message-Id: <20231031163104.112469-13-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231031163104.112469-1-benjamin.gaignard@collabora.com> References: <20231031163104.112469-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE 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]); Tue, 31 Oct 2023 09:32:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289402949448807 X-GMAIL-MSGID: 1781289402949448807 Simplify code by removing useless loop by using video buffer index. Signed-off-by: Benjamin Gaignard CC: Bin Liu CC: Matthias Brugger Reviewed-by: Andrzej Pietrasiewicz --- .../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