From patchwork Thu Oct 12 11:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 151954 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1164859vqb; Thu, 12 Oct 2023 04:47:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwEFMt0YXHjxj0JFr7IrV1tjA5UC9U9oFw30NZfJ4H25YRK+krOoXtROilphSkyaU53h8n X-Received: by 2002:a05:6a20:8408:b0:172:55c1:f1d4 with SMTP id c8-20020a056a20840800b0017255c1f1d4mr7549122pzd.4.1697111266241; Thu, 12 Oct 2023 04:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111266; cv=none; d=google.com; s=arc-20160816; b=lOtLwProYAehc7NbbMWqdU6l0SyZK8Q9/20hQ7Rmt0BCqwTC+2SmJ4AB1AtaaMHkMv oHL/wWH2vbouWQyKtZWUCB1SOCfXvg+V0PN+jp6k76+VFTLGMfxW3M+42rswCZEkE9F3 Q4CpNC+pyyPtcZGqGDHWH2WKz1N9B+kfVS3oscFDq+GNRUch0dg4fVi3/j4GBXdCnAU8 ux7nIK2JADvgVY2t0AFL4v/1qerZbL4ClsKqPpRnbSqxWU0SP4q/CNPo8HkJCi7FeiLM Cdksm6bAxRirXHN99oVfjEgyte+vcpR727jwx0fXZGYIM8q0NWeC0orlZ45bIogBQmFK ZC1g== 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=R40MP8ttmGzQyMoa2ie6K5MhqygBn3EUXZhft/1Gf/3ZmpjvMWo1YCVDF2sbgYWjoX th+KRCuck7OVRSoJRJkaeNA2FOreZQuzGDQUFeI6N7fQ1WPJUInxR9vr8ErQ0Nze+Fge 4V1Z7XZuEQRpoHbsKshoT0sG42J9e16kX8Nif5+SYnSdF3clwjvTwejAnkRVUsW8lM3t a/KL+WDP5Scqc1zGbM7yy1GIXcxrH/3EISoFMygU1z3M7U6zmRKYXvoTVd2obu+r+ie3 kewBajqEM7/QyKYHz9Da87Y0yjumtVRkGhIWoMDDQ4wIqszfUZd0/+Z+wZwnwn6hgJjJ jniw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YW55GPui; 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p21-20020a170902a41500b001c62e465391si292986plq.147.2023.10.12.04.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:47:46 -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=YW55GPui; 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 41C74822CC07; Thu, 12 Oct 2023 04:47:45 -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 S1378684AbjJLLrg (ORCPT + 19 others); Thu, 12 Oct 2023 07:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378398AbjJLLq7 (ORCPT ); Thu, 12 Oct 2023 07:46:59 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D25DCC; Thu, 12 Oct 2023 04:46:57 -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 99D886607359; Thu, 12 Oct 2023 12:46:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111216; bh=LFTEg/R/Wor/QN2odw5Z+gHhYekb/C2BteTgt/nxpjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YW55GPuiNAo1nw5erBfgCCEKO1clLvGNiedo9r43ueQ6UvP4U/glJh2RXx4j9HFXc A8YqtaHCe53j68YuaVmPDgxDS9V/YBbGRDuCIB59vKMuHRABdjQzPnBhNuGVznZFRO 5buTjaiW5trxoTqgo6O2+6jLQG3NPgIas2KlC+TVpAxhH5QPJotUKwHX9UC/6s1ULN 9+UlEOfJ7/8QOxjcA5UqRS9/6pNLrJrSG5wnOsQK68z8fW6RyiQXTf/wXgkuQWc/g0 leTBSXi1j6a4JmymT+lNdj1dM1jnsT6LotrrSUf0BfdnxHNmTXrrMqBqStNM39WUbV CI/NBJI/Sl/eA== 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 v11 12/56] media: mediatek: vdec: Remove useless loop Date: Thu, 12 Oct 2023 13:45:58 +0200 Message-Id: <20231012114642.19040-13-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 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:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779550142742233428 X-GMAIL-MSGID: 1779550142742233428 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