From nobody Mon Sep 15 04:13:43 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AD37C46467 for ; Sun, 15 Jan 2023 09:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230210AbjAOJ0s (ORCPT ); Sun, 15 Jan 2023 04:26:48 -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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/g= pu/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; =20 - struct clock_voltage_caps temp =3D {0, 0}; uint32_t i; uint32_t j; =20 @@ -3032,14 +3031,8 @@ static enum bp_result construct_integrated_info( for (i =3D 1; i < NUMBER_OF_DISP_CLK_VOLTAGE; ++i) { for (j =3D 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 =3D info->disp_clk_voltage[j-1]; - info->disp_clk_voltage[j-1] =3D - info->disp_clk_voltage[j]; - info->disp_clk_voltage[j] =3D temp; - } + info->disp_clk_voltage[j-1].max_supported_clk) + swap(info->disp_clk_voltage[j-1], info->disp_clk_voltage[j]); } } =20 --=20 2.34.1