Message ID | 3b1eb0d7.3f.184245eccc6.Coremail.wangkailong@jari.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;pusanteemu@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 Content-Transfer-Encoding: base64 Content-Type: text/plain; charset=UTF-8 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
drm/amd/pm: replace ternary operator with max()
|
|
Commit Message
KaiLong Wang
Oct. 29, 2022, 3:31 p.m. UTC
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 <wangkailong@jari.cn>
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
Comments
Hi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on linus/master v6.1-rc2 next-20221028] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/wangkailong-jari-cn/drm-amd-pm-replace-ternary-operator-with-max/20221029-233830 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/3b1eb0d7.3f.184245eccc6.Coremail.wangkailong%40jari.cn patch subject: [PATCH] drm/amd/pm: replace ternary operator with max() config: parisc-randconfig-s031-20221030 compiler: hppa-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/3c108bd6207a75833150ef3ad12b224364f95c88 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review wangkailong-jari-cn/drm-amd-pm-replace-ternary-operator-with-max/20221029-233830 git checkout 3c108bd6207a75833150ef3ad12b224364f95c88 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash drivers/gpu/drm/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c: note: in included file (through drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_virt.h, drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h, ...): drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:314:49: sparse: sparse: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" >> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c:349:40: sparse: sparse: incompatible types in comparison expression (different type sizes): >> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c:349:40: sparse: unsigned int * >> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c:349:40: sparse: unsigned short * vim +349 drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c 303 304 static int vega10_odn_initial_default_setting(struct pp_hwmgr *hwmgr) 305 { 306 struct vega10_hwmgr *data = hwmgr->backend; 307 struct phm_ppt_v2_information *table_info = 308 (struct phm_ppt_v2_information *)(hwmgr->pptable); 309 struct vega10_odn_dpm_table *odn_table = &(data->odn_dpm_table); 310 struct vega10_odn_vddc_lookup_table *od_lookup_table; 311 struct phm_ppt_v1_voltage_lookup_table *vddc_lookup_table; 312 struct phm_ppt_v1_clock_voltage_dependency_table *dep_table[3]; 313 struct phm_ppt_v1_clock_voltage_dependency_table *od_table[3]; 314 struct pp_atomfwctrl_avfs_parameters avfs_params = {0}; 315 uint32_t i; 316 int result; 317 318 result = pp_atomfwctrl_get_avfs_information(hwmgr, &avfs_params); 319 if (!result) { 320 data->odn_dpm_table.max_vddc = avfs_params.ulMaxVddc; 321 data->odn_dpm_table.min_vddc = avfs_params.ulMinVddc; 322 } 323 324 od_lookup_table = &odn_table->vddc_lookup_table; 325 vddc_lookup_table = table_info->vddc_lookup_table; 326 327 for (i = 0; i < vddc_lookup_table->count; i++) 328 od_lookup_table->entries[i].us_vdd = vddc_lookup_table->entries[i].us_vdd; 329 330 od_lookup_table->count = vddc_lookup_table->count; 331 332 dep_table[0] = table_info->vdd_dep_on_sclk; 333 dep_table[1] = table_info->vdd_dep_on_mclk; 334 dep_table[2] = table_info->vdd_dep_on_socclk; 335 od_table[0] = (struct phm_ppt_v1_clock_voltage_dependency_table *)&odn_table->vdd_dep_on_sclk; 336 od_table[1] = (struct phm_ppt_v1_clock_voltage_dependency_table *)&odn_table->vdd_dep_on_mclk; 337 od_table[2] = (struct phm_ppt_v1_clock_voltage_dependency_table *)&odn_table->vdd_dep_on_socclk; 338 339 for (i = 0; i < 3; i++) 340 smu_get_voltage_dependency_table_ppt_v1(dep_table[i], od_table[i]); 341 342 if (odn_table->max_vddc == 0 || odn_table->max_vddc > 2000) 343 odn_table->max_vddc = dep_table[0]->entries[dep_table[0]->count - 1].vddc; 344 if (odn_table->min_vddc == 0 || odn_table->min_vddc > 2000) 345 odn_table->min_vddc = dep_table[0]->entries[0].vddc; 346 347 i = od_table[2]->count - 1; 348 od_table[2]->entries[i].clk = max(hwmgr->platform_descriptor.overdriveLimit.memoryClock, od_table[2]->entries[i].clk); > 349 od_table[2]->entries[i].vddc = max(odn_table->max_vddc, od_table[2]->entries[i].vddc); 350 351 return 0; 352 } 353
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; }