Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3598792rdg; Tue, 17 Oct 2023 23:16:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE97As9YAp3MZQ2p4wrAxrDfd+r+xvuKDFUDvAp/qTmPYRC0IEfTcBhvQCeMSfmw9dIgHFT X-Received: by 2002:a17:903:189:b0:1ca:7f91:aa5d with SMTP id z9-20020a170903018900b001ca7f91aa5dmr4416649plg.16.1697609767030; Tue, 17 Oct 2023 23:16:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697609767; cv=none; d=google.com; s=arc-20160816; b=vVzNywUBDsrYS2MVLkeRx4B34yb3/3Vg2oq8yrXEA5TZZcIussYC90UuKMXrMO1rcY Bmxke3qVxiU5GbK8nE/sgVbzfKhE4dEMdyNDjSWtMIIUjSRBiIMNnPW05fKA0pg+mUnc Uu/jYQRXPq0AmzROJmnSPB3X3B5UbY/z1xS7O6gVfvlIqogC4LXSB4fZVotGZPOR8lTU SzlC+I2OnioB/8dbRMqLVk99+CmfscRXldopL50KnGx4jiEbas1PjzoKUxWNWNRG4Mxr MatOpcXdcHhfNYjEhesf0UlmoOMphfT0G+rdGcsENtYpbkg2taY1fpeCXKjLUCLTDAhx 6pvA== 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 :message-id:date:subject:cc:to:from; bh=1Klw+JvUEqR06vzudoG1Z/Yf2Zf/m0isl3hjv4nh0pc=; fh=E1fo2IoakCsND4Z1T+2sQQRs8VNzX6aoehAGQmx3eks=; b=SiHsAFWA9tfpIQOnALHycA3SfFVDQ6gDZTH5+FG4W59o6XMmMVdPAYZVfcTvw2aZ4K b6ZKIpaSLGSaS62OX/clgYGSDyI53FwZTi6dGMWwPPWfwXX1J5gLLveR35X+kceitMqA vvH1si/9P68pYfVj9tgmnKjZf8DcgD0p4t/UNiA4NOGvYi0IZhM/j6LX1snidpgqvvYj JktEdzOzG57i1AiMZErsxtC96IfhRSQ0OfyF9PWA3X3xn2iKmqTt0UhOWI/NmskTN2Ju knjKTAWRtt5Q86rWnG8WNLxDUb7D210XjbolyWZwSAzaWn/KPDWBUKSV2M+kPD5uQJra YpKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id c1-20020a170902d48100b001c77674ea94si3781296plg.434.2023.10.17.23.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 23:16:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id BDBBD80B8F41; Tue, 17 Oct 2023 23:16:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344468AbjJRGPs (ORCPT + 99 others); Wed, 18 Oct 2023 02:15:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbjJRGPr (ORCPT ); Wed, 18 Oct 2023 02:15:47 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E548A93 for ; Tue, 17 Oct 2023 23:15:43 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R691e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VuPi1lq_1697609732; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VuPi1lq_1697609732) by smtp.aliyun-inc.com; Wed, 18 Oct 2023 14:15:41 +0800 From: Jiapeng Chong To: harry.wentland@amd.com Cc: sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] drm/amd/display: Use swap() instead of open coding it Date: Wed, 18 Oct 2023 14:15:31 +0800 Message-Id: <20231018061531.11565-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Tue, 17 Oct 2023 23:16:03 -0700 (PDT) Swap is a function interface that provides exchange function. To avoid code duplication, we can use swap function. ./drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c:445:127-128: WARNING opportunity for swap(). Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6903 Signed-off-by: Jiapeng Chong --- drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c index 36baf35bb170..5cbb2db9dfd1 100644 --- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c @@ -425,7 +425,6 @@ static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes) { bool sorted, swapped; unsigned int cur_index; - unsigned int temp; int odm_slice_index; for (odm_slice_index = 0; odm_slice_index < pipes->num_pipes_assigned_to_plane_for_odm_combine; odm_slice_index++) { @@ -441,10 +440,7 @@ static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes) swapped = false; while (!sorted) { if (pipes->pipes_assigned_to_plane[odm_slice_index][cur_index] > pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1]) { - temp = pipes->pipes_assigned_to_plane[odm_slice_index][cur_index]; - pipes->pipes_assigned_to_plane[odm_slice_index][cur_index] = pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1]; - pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1] = temp; - + swap(pipes->pipes_assigned_to_plane[odm_slice_index][cur_index], pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1]); swapped = true; } -- 2.20.1.7.g153144c