From patchwork Sun Jan 15 09:26:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 43816 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp660509wrn; Sun, 15 Jan 2023 01:32:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXvYl24qFaZFKl8Rl1tEl4NB0Z9Zz8HyQ0SnKV8pgyoSgikluR6EQ2jnGr0c7kB0QISucuuJ X-Received: by 2002:a05:6a21:999c:b0:ac:6d11:1ec7 with SMTP id ve28-20020a056a21999c00b000ac6d111ec7mr127666304pzb.17.1673775170775; Sun, 15 Jan 2023 01:32:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673775170; cv=none; d=google.com; s=arc-20160816; b=g8g/wWvGBd5wIk6GCYv9YzQrR6R5qmTyIH2CcDB5G/JC8N/x78QW8J9P8GXMtPp3n3 uoKHKQY3yPfhHy2+EZHGqy7qzuaB9XI+wtxklvyuhvWaz7HOhYBMpmgYDfmNIsZV+lR+ S2bTRWthy1hw/nItNEMHfQLxhmj6cAfQF/hbZ34scZa5GcRUUy2ztO39Uht5tdwpimW8 2skLpH3PelLbhg/XdO4YtjsNc70+vFrt0G043yAKuM7qGRRMqV8SmKnrVPJr2NsJ7ALZ UlTz+h8CclC8rU2R03339w9dv1GFC296G8p4wIjpVMbTyk+rdlMnZ9jKrJE7FbV2FOHb Lsuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=4//gEnsaieyDrrmA2UZ26dFrn/t1c/2i1NibGk9lBs4=; b=rVQVJnbajA0qxa2Oc0DxCiHbRQn/YYI2pnKBLrCfYzsqgAwMHS8HzuBcf+2t/36xwB 3rYte46rQVEFlKfS/3bdCGc54r265XbAiWWL7v+jtLIk5JsImHUTT/VNWSG5IyBsbdg2 vRg8r8ae9K0pX6LcXfFeZWFFJIv1+ogX2KL2OBt0Z8pYUhvPO4Tq/I+zaL9zIakOQIqv PQUEF0+dMFPfw+yoqFdPGf/MWU7k0Ov8Y7RHP19hsf8DLv9QsmA7QC0IpeGFGbbg5g/d b2m1lLvlz95pvRTbGLteCygDMkl+A1Yh+Y1bp7CTrNn4IDM8NEXrHQsZvSQVvRXo3TCg FMfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=B4n9PFAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a654585000000b00497b791a396si26280356pgq.419.2023.01.15.01.32.36; Sun, 15 Jan 2023 01:32:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=B4n9PFAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230145AbjAOJ0r (ORCPT + 99 others); Sun, 15 Jan 2023 04:26:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbjAOJ0l (ORCPT ); Sun, 15 Jan 2023 04:26:41 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 054C859ED for ; Sun, 15 Jan 2023 01:26:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673774780; bh=EprenRK+fhh8LVQitW7gzersdR2rfcFOxO4xOWvTdwI=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=B4n9PFAiYsPvtQTfY06WMQg1lKrwJzas9oAiFGLlj2qWWC5DkV4JtR8Paw39YQmlo 2VjC6gvFWm90AwOlhI7bsy7t3+UKOQs2mVJ3/pMLrnpicpKxTNJCti6BXFqYachjSg 7a/eWi5G1tLfKID7kipr9JHkSiQK3Vb7VOwywmyA= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 15 Jan 2023 10:26:20 +0100 (CET) X-EA-Auth: u3SH4wvgyxfpkBx0jrY/UYMRZuoD5GiSOPyFx6yICV+SBVN9aEAYXtgpuLPHhsdublOVQMOBuwfWuhfXeLdMLGNNHuH6VNPg Date: Sun, 15 Jan 2023 14:56:14 +0530 From: Deepak R Varma To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , Christian =?iso-8859-1?q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH] drm/amd/display: use swap() helper macro in bios_parser Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755080473756446524?= X-GMAIL-MSGID: =?utf-8?q?1755080473756446524?= Use swap() helper macro instead of open coded swap instructions. The change also facilitates code cleanup and realignment for improved readability. Issue identified using swap.cocci Coccinelle semantic patch script. Signed-off-by: Deepak R Varma --- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index 074e70a5c458..7b5894adbf51 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -2929,7 +2929,6 @@ static enum bp_result construct_integrated_info( struct atom_common_table_header *header; struct atom_data_revision revision; - struct clock_voltage_caps temp = {0, 0}; uint32_t i; uint32_t j; @@ -3032,14 +3031,8 @@ static enum bp_result construct_integrated_info( for (i = 1; i < NUMBER_OF_DISP_CLK_VOLTAGE; ++i) { for (j = i; j > 0; --j) { if (info->disp_clk_voltage[j].max_supported_clk < - info->disp_clk_voltage[j-1].max_supported_clk - ) { - /* swap j and j - 1*/ - temp = info->disp_clk_voltage[j-1]; - info->disp_clk_voltage[j-1] = - info->disp_clk_voltage[j]; - info->disp_clk_voltage[j] = temp; - } + info->disp_clk_voltage[j-1].max_supported_clk) + swap(info->disp_clk_voltage[j-1], info->disp_clk_voltage[j]); } }