From patchwork Sat Oct 29 15:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 12734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1410360wru; Sat, 29 Oct 2022 09:05:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6c23L13KRDtf4PmxO2cZmcx7yltcIIpi3AQtwR4bl8JWJsqwOlS5MOpFbEWYUwsTn9pbFZ X-Received: by 2002:a17:902:e804:b0:186:5736:2b70 with SMTP id u4-20020a170902e80400b0018657362b70mr5068554plg.127.1667059554003; Sat, 29 Oct 2022 09:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667059553; cv=none; d=google.com; s=arc-20160816; b=DdiTynTFXxweoOIIKWrOlG0sNGat6Ppipqx+wqR3NasuWnuL8MlZi6D9BeM3zlcxVx V6s30yOumXFf/yWcW2C8f0siZ1T43BDnPspYACA70vlUrmLHwnASi12YSDwxwPKbhX85 6B5gQgmqucT3f6cRvs82bzM0atWYAAGBv0b+9QDwN/w3FeTQjHE5S0QyX3yljWrKtWxH 5BDI2FHH03ic2teOK1bJILm2dNfRCP6OkyQBGqw7zhVkHPwbezzaavMskN0XjhAermMF bzHYEn3oBrWdadRu/JtZNI6CsPcNyEChIkzv48qFhncxaGKhlcd5GWi32DRFmpMasObu /CAA== 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=qzzu8e07ZcWm9393EN68309LUBbDXktbjE3xVxjk0Ds=; b=eKbQyK2A2wbnLApqUkjhAxTuD3dW/kBedbuPpkSFvQGVuGDpZt8CZZoEbzbxZ6y92A AdXKf/iQw/q+xM+0vZ+MJrgZLpQUBWCFAO+4H8ERQxWu99q+UHsPRz6DqNyqxzmHQ/Qx DgxQVsc50aOj0vGFZ+fZnNVeW2xMdjvH2cQBwqp68qd0JSw02pxCJj4k6hTFAuCC0ROA L3heSv5xFszjohqVwBJOzd0Dt873ShxnB5asvsqB9sS/mXLPUgZsfvdO7+0QB6S0n1Fd fn2MLIVPtAeAjvWHmFhWqwNGEHsPqUSfZnL0rMAXYe0vcrCsoic/GxTPgWmvM7bwtQbT XaPA== 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 x82-20020a633155000000b0046ed59f63desi2515876pgx.637.2022.10.29.09.05.39; Sat, 29 Oct 2022 09:05:53 -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 S229632AbiJ2PgW (ORCPT + 99 others); Sat, 29 Oct 2022 11:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiJ2PgV (ORCPT ); Sat, 29 Oct 2022 11:36:21 -0400 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E32ECB3D for ; Sat, 29 Oct 2022 08:36:20 -0700 (PDT) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sat, 29 Oct 2022 23:31:43 +0800 (GMT+08:00) X-Originating-IP: [182.148.13.81] Date: Sat, 29 Oct 2022 23:31:43 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: airlied@gmail.com, daniel@ffwll.ch, evan.quan@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com Cc: darren.powell@amd.com, aleksei.kodanev@bell-sw.com, tangmeng@uniontech.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amd/pm: 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: <3b1eb0d7.3f.184245eccc6.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCHj+BfR11j5+AAAA--.10W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAOB2FEYx0BJQAFsy 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?1748038638874902738?= X-GMAIL-MSGID: =?utf-8?q?1748038638874902738?= Fix the following coccicheck warning: drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:348:85-86: WARNING opportunity for max() drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:351:52-53: WARNING opportunity for max() Signed-off-by: KaiLong Wang --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c index c8c9fb827bda..35677c13ddf9 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c @@ -345,12 +345,8 @@ static int vega10_odn_initial_default_setting(struct pp_hwmgr *hwmgr) odn_table->min_vddc = dep_table[0]->entries[0].vddc; i = od_table[2]->count - 1; - od_table[2]->entries[i].clk = hwmgr->platform_descriptor.overdriveLimit.memoryClock > od_table[2]->entries[i].clk ? - hwmgr->platform_descriptor.overdriveLimit.memoryClock : - od_table[2]->entries[i].clk; - od_table[2]->entries[i].vddc = odn_table->max_vddc > od_table[2]->entries[i].vddc ? - odn_table->max_vddc : - od_table[2]->entries[i].vddc; + od_table[2]->entries[i].clk = max(hwmgr->platform_descriptor.overdriveLimit.memoryClock, od_table[2]->entries[i].clk); + od_table[2]->entries[i].vddc = max(odn_table->max_vddc, od_table[2]->entries[i].vddc); return 0; }