Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1071272rwb; Sat, 14 Jan 2023 13:36:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXsnvr2zlXXoDYz4s/5tktjAbPK/Vc+wATbzk2G9yTAFTRBV95SUupcXcdO1MliigzPH3kW6 X-Received: by 2002:a17:902:ed92:b0:192:7a02:31a7 with SMTP id e18-20020a170902ed9200b001927a0231a7mr16034755plj.49.1673732166062; Sat, 14 Jan 2023 13:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673732166; cv=none; d=google.com; s=arc-20160816; b=aq08GNXSjqwGURVkwZzIIWNFFyTuA8v8o6MRzYNIKDsXSK5sp8sXA38suBF0tgf1aK 3eY0iklB5ehDXDtDxoznp2ysoWjJVYgHmBFqt1yOyr6N8xmiWdkclwJ9m7Xg6sBu1R9J tqOFtE0Ed4R5yAEfBfohnosygsLMKMYi1B2o3RxqXy08E75eiVNM+qoQIsznG0G9OqZq 29vI7Lv1XwvGdA4BDnoBZiVudHptznThSZ19BjWXVeaLUVl+2UpIJ/NrRs4cgU+gOKmK wT1fxKSbY1SiKDQoKkMz1OVGZVATlMCCv/SO7LyTRwzRGzPZ1asDj8d0K3MucT+fajtx cnFg== 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=raP3gLTc+FM2qlTHOYgg7wuMmWVmBkZePpyp5WHZoSo=; b=mn/5h4mJPAd6ETbL8Sze5gVT2XSpu1N250hyXcR4BnBdC2Ge0SZEsTmEOFEgn2BcTn Qi637aEhoJPHgwpPykFH9g328GEZioUBoFLHXNy7mx9vW65P7VLdI3eeVZKNoYQY6GB7 E5SHEEaGBARAPRR7x+07OI9WiFQEAmNKc1FucdAPyTb9jSO8FHop+QAAt5VPaYsQeAEG shwD/G7Ff42sQ5ysATXipVHRjsmNDlxaHUo9eAc2eMyv6q5MarQfGrv+Ved+pgAr6UgV d3zBDygKyEeZ1tjiCXnYbRvWMVB2pjL5j4liMpXwkkGEKZX+jgybQKZ1j4dgPoQwnpfL j15w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=mUufoRU+; 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 m27-20020a634c5b000000b00473d2108701si25095733pgl.198.2023.01.14.13.35.58; Sat, 14 Jan 2023 13:36:06 -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=mUufoRU+; 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 S230261AbjANVUI (ORCPT + 52 others); Sat, 14 Jan 2023 16:20:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbjANVTw (ORCPT ); Sat, 14 Jan 2023 16:19:52 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26F149EDA for ; Sat, 14 Jan 2023 13:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673731183; bh=owq0V8Z5J5JXHykzSdI48m2IFtIiUsNYU2CP5ngYPr0=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=mUufoRU+8iSF5aXSDt3h7gFlOj8ZSAFBukg/PowlUKMV1bfjgYMcr1KCErQf9uvO4 S5WgCuiEU+ohY3zJ6xdXtdlgmwSuK7Lap0yFZZ/y33dRL3kfcrdetIJXJ3QLWGPkKD +U/iNDsDJ8KICHOFmRgVgwLxIX0YL7uPMOFuQoTA= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 14 Jan 2023 22:19:43 +0100 (CET) X-EA-Auth: XjbgxV8xfhLFIR/KHb5unaAxENENTr1v3YYLJmUp0lp/06kHa7M69jD4pjH5hvopgPaes/9RFKsiI3zxVKjnvNz2UL7P7CaC Date: Sun, 15 Jan 2023 02:49:39 +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 1/4] drm/amd/display: Use min()/max() macros in dcn_calc_math 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/calcs/dcn_calc_math.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c index cac72413a097..81629f3715d3 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c +++ b/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c @@ -52,12 +52,12 @@ float dcn_bw_min2(const float arg1, const float arg2) return arg2; if (isNaN(arg2)) return arg1; - return arg1 < arg2 ? arg1 : arg2; + return min(arg1, arg2); } unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2) { - return arg1 > arg2 ? arg1 : arg2; + return max(arg1, arg2); } float dcn_bw_max2(const float arg1, const float arg2) { @@ -65,7 +65,7 @@ float dcn_bw_max2(const float arg1, const float arg2) return arg2; if (isNaN(arg2)) return arg1; - return arg1 > arg2 ? arg1 : arg2; + return max(arg1, arg2); } float dcn_bw_floor2(const float arg, const float significance) @@ -93,12 +93,12 @@ float dcn_bw_ceil2(const float arg, const float significance) float dcn_bw_max3(float v1, float v2, float v3) { - return v3 > dcn_bw_max2(v1, v2) ? v3 : dcn_bw_max2(v1, v2); + return max(v3, dcn_bw_max2(v1, v2)); } float dcn_bw_max5(float v1, float v2, float v3, float v4, float v5) { - return dcn_bw_max3(v1, v2, v3) > dcn_bw_max2(v4, v5) ? dcn_bw_max3(v1, v2, v3) : dcn_bw_max2(v4, v5); + return max(dcn_bw_max3(v1, v2, v3), dcn_bw_max2(v4, v5)); } float dcn_bw_pow(float a, float exp) -- 2.34.1