From patchwork Sat Jan 14 21:19:39 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: 43796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp452166wrn; Sat, 14 Jan 2023 13:21:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXuxpcmILDB9hfHLUnM31SG6T2XTeK1Rn5EWDR2LX6JJTr/UEMWVt+c4KjAx9+cxUbVqR807 X-Received: by 2002:a05:6a20:6da9:b0:b5:a240:fec5 with SMTP id gl41-20020a056a206da900b000b5a240fec5mr16668199pzb.56.1673731294603; Sat, 14 Jan 2023 13:21:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673731294; cv=none; d=google.com; s=arc-20160816; b=hP6ERDVczRddQoHeqjHFKc6nRgWYLi5zN1cKCtCT4JEHsyQrqAG6zriZWEwyGJKFQO JimW7ymObayQLaUqcRyS7DAJmsOoioCIhgnM2X/oKAfnaFVYYPpg89WwyO7oGIDLHcdN rjtLyYgPvw1Cfui63+iEWO15Y9AWDU8C6ymWYjYxLEd/hEOpKbvzoFISynHpYyjwe7AB PpQY6AOZVCNhOWeYbWaCLsO6LCUo4nfXDPPFpTmMM/HAMAySThuUtXECLwb70R5WTccz TWTaDK6cnABN773L8pFTA0aQ/LIxVlcLTKwzwUG5U9P7aZjuEv8f/yzc4randdVAw0Ko F7Kg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a6546c3000000b0049f5dc6cf7csi24834706pgr.801.2023.01.14.13.21.22; Sat, 14 Jan 2023 13:21:34 -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 + 99 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-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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755034465671462054?= X-GMAIL-MSGID: =?utf-8?q?1755034465671462054?= 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)