From patchwork Tue Oct 3 08:06:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1928276vqb; Tue, 3 Oct 2023 01:07:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZTvCZ2CSGa5n7t9/bcr5HKeTMHZGo36zV0KxaNgDm7Z2s435BG+SnkC5y2bu5Yx8OYK2P X-Received: by 2002:a05:6a20:1044:b0:15d:ddeb:4a7e with SMTP id gt4-20020a056a20104400b0015dddeb4a7emr13337502pzc.49.1696320473531; Tue, 03 Oct 2023 01:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696320473; cv=none; d=google.com; s=arc-20160816; b=NAfMMGMeF7T5UPHnTtszZpYvdgpLgBWGqmqrewihnHU2BOUuGEaGpuUgxHi1kxX9Sr evb/HTzze7M+FAt+OZbPU005R6R3Zu5lQOs7JBy42gRjmFkfXojlAyCLu35Wa4LmGMWv ixnorjgXmFy7GaGmkgNHli9vewA7Uc6wYb/KxQ5CULvmxKE2YlELFi2AqceDudx0+J0n qEuYnGLK/GSR/gHr5AoQcYlzAWOlDmVWDfMjlI2PwrW0JYImNB1DZ8KIyfdHyYpRwbz+ BbUN82LnAzu8azgLdTulV/uLaDuvUTPcJyvGtzTexMhRU3oQmNHHU7j+E8hQ12OlW8NS qP2w== 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=s+kMPwU0Ob0ztoTAttuAaSUVI1oC9UCyetrTZTEeb8w=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=jLlfmMWb/wVCJleK8KMHb50YKsTVWF6t/2k1PZUEi4deIByDmllCfVO5vGJoBC79Iy GkGJBYhbhj6eFg8iT/yH78ou7Ce2edsNuIqn+K9CB6VFXj5BoDx5wp1f7PmQHqKpepar 2hLgstbUTCDgA/c/HoN9R3TYDFSFm3GQYg1zJj7zLAbpeQ3A2wZTtocz467IzB53CYxD xIIeamlDZ8Nq8y2VvRkRCVfjA4JZwKjGeu1ovCP2gsZR8MKaOvuSsubE4YnSBh45SI17 An2w4yjDTJHg6SBhwooTyumYpEjHi7fMYUXmeJudyC8p6LWyLN/QS2L8Cvko97fBmRGt bD0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Hu9hnDwW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cw23-20020a056a00451700b006906a716917si944028pfb.398.2023.10.03.01.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:07:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Hu9hnDwW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id B115F8227783; Tue, 3 Oct 2023 01:07:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239407AbjJCIHo (ORCPT + 18 others); Tue, 3 Oct 2023 04:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239307AbjJCIHX (ORCPT ); Tue, 3 Oct 2023 04:07:23 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51345B4; Tue, 3 Oct 2023 01:07:20 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:b6df:b784:6a0f:8451]) (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 EF994660731B; Tue, 3 Oct 2023 09:07:15 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696320436; bh=MAfzqnBElYsriZOe56F+JFfMksB0FEVAHWT7iRLKeFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hu9hnDwWa3LgG1MmRZ4kExxD3sCgCOT6w1kdLJtauCr6h5M/r8h2i9nIZxEMWq3Zh ixrqo5Y2Xyx2UbvflIeBBCU5WAjIDcstXx3oW/Imwn357J1hBvTAF+fh6SzifeF1FV JXwOUZfz8GxohIEUpi+e1Oc37hK+KB1Q36tE542mlUmmL1OlDdaw0jLVir0BZHcajN dVyM2PL8fFWqKbctO5VBkbPyfJewPStIQ8qEtOby7hj8FPc5W3e0uCbwd6rhLG1mOf rbu1/o71sNRRz+bwtURolirHpmIsJfP09cKd1TxqvBafEiDKAvQbe9rbdQ4DWCz71H Aj3tF7mPCTkHg== 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 v10 06/54] media: mediatek: vdec: Remove useless loop Date: Tue, 3 Oct 2023 10:06:15 +0200 Message-Id: <20231003080704.43911-7-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231003080704.43911-1-benjamin.gaignard@collabora.com> References: <20231003080704.43911-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,RCVD_IN_DNSWL_BLOCKED, 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 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 01:07:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778720936400074007 X-GMAIL-MSGID: 1778720936400074007 Simplify code by removing useless loop by using video buffer index. Signed-off-by: Benjamin Gaignard --- .../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