From patchwork Sat Oct 29 15:19:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 12733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1396616wru; Sat, 29 Oct 2022 08:28:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4m1XOggfzJw3K/hq8BAaxLMFK3yaoNaEy7e7pyL08cHHD85zEP71OWSADsyX1zQcIR8LP8 X-Received: by 2002:a63:6986:0:b0:43c:8417:8dac with SMTP id e128-20020a636986000000b0043c84178dacmr4404655pgc.286.1667057297682; Sat, 29 Oct 2022 08:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667057297; cv=none; d=google.com; s=arc-20160816; b=x/mPMdFdObEIRnen6iEPHn2DHHUswbSIW/OfJb36zwBho9d5iNFdFVuVplV2/l+kx9 OE/H9cexEtwDPEmH5uo1V+LWsUmQaw+B5SddWiducMPs4DFRL8fHhaQLyUiUDXStRwT6 EIR5E9vi9KtXzwwZzoUqG70tLGFXPFTOLaYFu8lCGBL8qCaqqJHuaT+c/6U58x3rUxa5 TcBS4lqrU4B2QOjzpDIOiMeP3uJjEJZl8GUSQ/YniMEHvbIJKQeFnklvTPT2QZnW7y25 TCuZJUZRVZgZEpU9ssOLd4uyhun1ZURbNqNxO+Y3lk157oue0zUy6czRx2+I2Q24vF0l 5BcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:subject:cc:to:from:date; bh=AwlfnhoFWwsvxeTOAhCTm+/X18QexKGue3skZwLKPN8=; b=tzX8/r9V0AosXmhLDyL3Fz7spBFH/poF8fNQUg+Q44mCOYqpGveVRQt1hKNDUc9WuG PVKdxfnijRO4CuXA8130fL3cCuktCkDv+3mKMR6Uqroy160K6OlHgmdurfo2Z3Bmcw0Y tc0pCOBJYfJ3qXodRxN93WPspQRPeNEUHNkasUu4QM1X/cXKIyfOn2Q1vqvM98CE2uOf 1Tbw7477ral61QrDiLZUpE5Ax7lypWNXJ3xsTABq6OOo/KyMxwQMCtl6wTJ4VC0yMCng 7o4VnaVCXf7ze8JMy5VVigYxydW/JsVXBk+RJREgZfGqeDQZTJjCVwDP1Dh10bmYnIPg CUkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q9-20020a63e949000000b004493c7cfb5csi2161954pgj.447.2022.10.29.08.28.04; Sat, 29 Oct 2022 08:28:17 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229678AbiJ2PYI (ORCPT + 99 others); Sat, 29 Oct 2022 11:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiJ2PYH (ORCPT ); Sat, 29 Oct 2022 11:24:07 -0400 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ACC7D52087 for ; Sat, 29 Oct 2022 08:24:04 -0700 (PDT) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sat, 29 Oct 2022 23:19:27 +0800 (GMT+08:00) X-Originating-IP: [182.148.13.81] Date: Sat, 29 Oct 2022 23:19:27 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: harry.wentland@amd.com, sunpeng.li@amd.com, airlied@gmail.com, daniel@ffwll.ch, HaoPing.Liu@amd.com, nicholas.kazlauskas@amd.com Cc: mario.limonciello@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amd/display: replace ternary operator with max() X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn MIME-Version: 1.0 Message-ID: <9d641b0.3d.184245391ec.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCXq+F_RF1jA+AAAA--.19W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAKB2FEYx0AVwALsL X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00,RCVD_IN_PBL,RDNS_NONE, T_SPF_HELO_PERMERROR,T_SPF_PERMERROR,XPRIO autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** 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?1748036273054901805?= X-GMAIL-MSGID: =?utf-8?q?1748036273054901805?= Fix the following coccicheck warning: dcn20_clk_mgr.c:314:WARNING opportunity for max() dcn20_clk_mgr.c:351:WARNING opportunity for max() Signed-off-by: KaiLong Wang --- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c index 650f3b4b562e..1aecdc5f73b6 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c @@ -311,7 +311,7 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base, new_clocks->disp_dpp_voltage_level_khz = new_clocks->dppclk_khz; if (update_dispclk) - new_clocks->disp_dpp_voltage_level_khz = new_clocks->dispclk_khz > new_clocks->dppclk_khz ? new_clocks->dispclk_khz : new_clocks->dppclk_khz; + new_clocks->disp_dpp_voltage_level_khz = max(new_clocks->dispclk_khz, new_clocks->dppclk_khz); clk_mgr_base->clks.disp_dpp_voltage_level_khz = new_clocks->disp_dpp_voltage_level_khz; if (pp_smu && pp_smu->set_voltage_by_freq) @@ -348,7 +348,7 @@ void dcn2_update_clocks_fpga(struct clk_mgr *clk_mgr, struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk; /* Min fclk = 1.2GHz since all the extra scemi logic seems to run off of it */ - int fclk_adj = new_clocks->fclk_khz > 1200000 ? new_clocks->fclk_khz : 1200000; + int fclk_adj = max(new_clocks->fclk_khz, 1200000); if (should_set_clock(safe_to_lower, new_clocks->phyclk_khz, clk_mgr->clks.phyclk_khz)) { clk_mgr->clks.phyclk_khz = new_clocks->phyclk_khz;