Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1098914rwb; Sat, 14 Jan 2023 14:11:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXvUVVPb0u8Ms94JrKjuzYydWYZ3jIa41iNUNtZTDW3HywmETj+Xbpj8Wo5/0bLd4o/StxQX X-Received: by 2002:a17:907:8b17:b0:78d:f454:3856 with SMTP id sz23-20020a1709078b1700b0078df4543856mr77907258ejc.19.1673734278709; Sat, 14 Jan 2023 14:11:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673734278; cv=none; d=google.com; s=arc-20160816; b=Xx0vbDWcZCU229Vbz4+SoWVKpseq4x56Fg4/3D6+a0jSrT62LeNV7UCab7G2i70lFK O4yqD+oMpIffWz+RJy9MbFKsRwod9D3ut3XHvZDmsJzKD9hq1s1U9UYwu/rldpvaUKND LpiCpAVlgIY88hDUmfKEvRKzjVF7quoCKt+syIJ0hDcSxur01P66Dlb151Qf2u5B8JVk eDZrI1h8lm6QlcZU+V/YpA0/OLNMZVjTPXa2K7mHwDLdm3+TcA3hbN2pz2xSpmflaL75 69GxGLkr2kae4V49DvNGDpYFjC0DUckbWSX9kRnhakXX1hHO+pMlLBI87Wsut9MX3aeL 1zdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VM+2vqKBG2T0rI6rf5w5mqz8n4mcLs5+ZM4TS3gElSY=; b=SxA5K7sv5W9eKeWtKGmcOoscwtMtNP3tw0G+Mf8i+60YAMlmeS9m7zFi4k+mKFkZpG rVhQnzgL6vYfNmF6INzAVEvimsNJVE7gy8qBh55RyDT2GjerdoABf1gKXKopF84FVQED ByjKUcS4qm1oahOpJaks9uk4iIqJ7UjkKxWCk56CbGxTPsSmzvnhpr8Y9g6X50CpoQMK y5/4JwLW/5CvHi04r2aA7I0vqUU1eW7kdymwUKwxrktxLYE1p7kCf2vPy4poU6pqzjTm vxoT8HxPsvtqz+b2xjGJm2y0qAatzf4xJSz3rULDg8EmLse6By+hiqFv4HdvisZBXKnJ vwfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=CmnvkdPl; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg3-20020a170907320300b007d161a8106csi24851558ejb.982.2023.01.14.14.11.06; Sat, 14 Jan 2023 14:11:18 -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=CmnvkdPl; 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 S230477AbjANVU5 (ORCPT + 52 others); Sat, 14 Jan 2023 16:20:57 -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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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( dst_y_prefetch_oto = Tpre_oto / LineTime; - if (dst_y_prefetch_oto < dst_y_prefetch_equ) - *DestinationLinesForPrefetch = dst_y_prefetch_oto; - else - *DestinationLinesForPrefetch = dst_y_prefetch_equ; + *DestinationLinesForPrefetch = min(dst_y_prefetch_oto, dst_y_prefetch_equ); *DestinationLinesForPrefetch = dml_floor(4.0 * (*DestinationLinesForPrefetch + 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( dst_y_prefetch_oto = Tpre_oto / LineTime; - if (dst_y_prefetch_oto < dst_y_prefetch_equ) - *DestinationLinesForPrefetch = dst_y_prefetch_oto; - else - *DestinationLinesForPrefetch = dst_y_prefetch_equ; + *DestinationLinesForPrefetch = min(dst_y_prefetch_oto, dst_y_prefetch_equ); *DestinationLinesForPrefetch = dml_floor(4.0 * (*DestinationLinesForPrefetch + 0.125), 1) / 4; -- 2.34.1