From patchwork Mon Oct 2 12:05:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1528581vqb; Mon, 2 Oct 2023 09:07:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyZYI+zkd6isCv+yK7Zmn4TIw0VzfEpPfQYv57oo9bnNgQt/3OVyGDMM0SWL/YAcNuLr/B X-Received: by 2002:a05:6a00:1788:b0:68f:c309:9736 with SMTP id s8-20020a056a00178800b0068fc3099736mr11497119pfg.3.1696262843442; Mon, 02 Oct 2023 09:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696262843; cv=none; d=google.com; s=arc-20160816; b=Xm49o6USQ7TvSFhZH5S85+2pmlChEcR/gnnW00buOXtHk39wwXPWW2TM8SKowtNI1H EL+CEt1f/p1EmTsynzEbo2ErjtmUj3+4BuQSNGKKIkL8rk9onrRDcYYzU1T/nR41x9Dx BHxpGuwmQ/0RFkUrTZBTfpDKK2nMCJniaK+LFZz9JY5sFPasMfhKcEUwY6bcUB7qwE8F H4mv7D72/HtjPcP46skwDnsFSkQ8kAoNAHiLW0qZIxvGl+/JQpTfncuoNcygm197X+Yz RpPo3mf1E0vZbNSsqove1GLGgnZjxkjNuCJPzd1aYv3w8LbhAiNFh/qc3Ta0gUe3BYI9 UpqQ== 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=bcPC3GzdUs5BHYyYY+rebpaKXiJgDXMJ37HTzEsVpkYciMY/+ePwi6wC4h8vW6iGNS XJbLcazTSff2uxzhgnP0DMB3cgMvdkqlxTPQatY6PW/jpGx8EXf7yYnGfbRdb++dfIfD og5Lv5hsgCNGv4gw/hSf/Vji2iczejDlgtzYzjfP8ADxX45D4ljK5W18NbWhpzalRTyx tYnWbxUY1aF1Ct3hlO+7egxnUnmsFoJPhOLEARWUR6mNZlel+p3x/oGBK1GQ1NvxwHe6 4wYX79b+KysP7IIznzcz91RdEPXYde7WafiOouj4wG8ZDJrwW0ZxbyhliNQn1dbeCOGZ hldA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="gQft/qs4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h9-20020a056a00230900b0068fba70d25dsi29697359pfh.33.2023.10.02.09.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 09:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="gQft/qs4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 26C7E806303A; Mon, 2 Oct 2023 05:08:08 -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 S237064AbjJBMG4 (ORCPT + 18 others); Mon, 2 Oct 2023 08:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236984AbjJBMGd (ORCPT ); Mon, 2 Oct 2023 08:06:33 -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 76A3CD3; Mon, 2 Oct 2023 05:06:29 -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 9CE336607314; Mon, 2 Oct 2023 13:06:27 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248388; bh=MAfzqnBElYsriZOe56F+JFfMksB0FEVAHWT7iRLKeFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQft/qs4HXHcaOnvsTV1VjfLtIR4x6frTn77MseWecOwzxMKmTVmft0lsnmGNa6On 2HHrXuVCR5s7Hz+C3s0duze8XZOStWWbxDTPaalTbQBpJs6j3dWDHIaGnD73gebmd7 3+rOKk6ULRfiOU5QMtOcVjjcQIPIXj3ll3GL095Dde5Ew0IhGFTXB9GBdZHsOJeOco gV2pEqHk+/NWMDQclk3UM4QZu5U3iLMFDe6pBXtUXnKpd8ORJYhnh1iq8qPDBBzwrH x/z6MLJINJYdc+eyeOfpDmgGIOMnc3kIv8torqzwf1Z6xa3WxZj7RAfye/0nZackJ4 /8O4PridKzwYw== 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 06/53] media: mediatek: vdec: Remove useless loop Date: Mon, 2 Oct 2023 14:05:30 +0200 Message-Id: <20231002120617.119602-7-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:08:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778660507433924385 X-GMAIL-MSGID: 1778660507433924385 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