From nobody Mon Sep 15 06:15:00 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 81C8AC3DA78 for ; Sat, 14 Jan 2023 21:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbjANVU6 (ORCPT ); Sat, 14 Jan 2023 16:20:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbjANVUt (ORCPT ); Sat, 14 Jan 2023 16:20:49 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8B29ED9 for ; Sat, 14 Jan 2023 13:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673731242; bh=4z9iFsp+DoxOPsRSJrEoIW+T8SbcfTIo02z3jd9D0wM=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=CmnvkdPl6rp+Kbmh0xBTbVHp2sV2BGpyAvubPOyhS5BQIaNp3pYHMKajTRf/bdFfV zlySr32Jo+FnBoPPlKg31edrfRnLWY/aiAa/xKE7EiaysV1fmDnOSDzBhjtLTiTmiI 9YyW5KE1CthR2zbwTvrI2qfoCriqGd93Wfz1W4Xs= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 14 Jan 2023 22:20:42 +0100 (CET) X-EA-Auth: cG/HSE5fIY7LcfmQRMBTYSk9qPaokkOPoCvufGol1mWz4fKAhqA0EQkemPxgt247sp/8c2u/07Yh6IU0+a9uvEVBusVi5/7j Date: Sun, 15 Jan 2023 02:50:37 +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 2/4] drm/amd/display: dcn20: Use min()/max() helper macros Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 the standard min() / max() helper macros instead of direct variable comparison using if/else blocks or ternary operator. Change identified using minmax.cocci Coccinelle semantic patch. Signed-off-by: Deepak R Varma --- .../gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c | 5 +---- .../gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c= b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c index d3b5b6fedf04..850bb0f973d4 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c @@ -626,10 +626,7 @@ static bool CalculatePrefetchSchedule( =20 dst_y_prefetch_oto =3D Tpre_oto / LineTime; =20 - if (dst_y_prefetch_oto < dst_y_prefetch_equ) - *DestinationLinesForPrefetch =3D dst_y_prefetch_oto; - else - *DestinationLinesForPrefetch =3D dst_y_prefetch_equ; + *DestinationLinesForPrefetch =3D min(dst_y_prefetch_oto, dst_y_prefetch_e= qu); =20 *DestinationLinesForPrefetch =3D dml_floor(4.0 * (*DestinationLinesForPre= fetch + 0.125), 1) / 4; diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2= .c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c index edd098c7eb92..6f4903525acc 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c @@ -686,10 +686,7 @@ static bool CalculatePrefetchSchedule( =20 dst_y_prefetch_oto =3D Tpre_oto / LineTime; =20 - if (dst_y_prefetch_oto < dst_y_prefetch_equ) - *DestinationLinesForPrefetch =3D dst_y_prefetch_oto; - else - *DestinationLinesForPrefetch =3D dst_y_prefetch_equ; + *DestinationLinesForPrefetch =3D min(dst_y_prefetch_oto, dst_y_prefetch_e= qu); =20 *DestinationLinesForPrefetch =3D dml_floor(4.0 * (*DestinationLinesForPre= fetch + 0.125), 1) / 4; --=20 2.34.1