Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp64853pxm; Fri, 25 Feb 2022 04:06:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTRiDPb3QovmdW2WzTBX3zrx6C2heqPpvfwjZ2moWi1rnAYkMkxt7z8t1+UUvbelIxkZrR X-Received: by 2002:a05:6402:148d:b0:410:b099:86f1 with SMTP id e13-20020a056402148d00b00410b09986f1mr6969234edv.273.1645790793896; Fri, 25 Feb 2022 04:06:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645790793; cv=none; d=google.com; s=arc-20160816; b=QAsgWby0T5hqpyDOLLMu1su7dOW7nGnBsGsL3RQcKhY7XXKIQ+X5vUti5QtWMxKpv0 s8i9wMgIjA9B5aHlGMWN48+luciDdHr18gZkUKnbBfbvQI24/TVZIcDRjnU7qj9AZ1Z3 aDGsIseX05ImMAWda/N/IKVp9urE80BBwFemfanVANRqVuTAd++DMkN7Do9r6DlFDANh yB8ZRnnRcNr/iTsYFrV0oRqs9BREt66+lxcKFCjQCfvU1GD3G4hpsyXYXB+eGCYSftCE UXYLl0swdz9vrgW0XT++BqvbT+KjvYyrI5Oy4vem92w+nOWQvLMjLZ3vOWn4GlKSooPg AObg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=+mL9MIZ/EhZp3c0TDy7rUAOPbUGApFAEhjayPQfeaXA=; b=wiSJsOCQgS9SCAhBTBV65XzrxgHPelpFS84R+CV8QFxKrdN+Qq4geEQgWMTsWPa25N P3KmOhQT+I2pyygHHy75jnZBnmxlhqaRKUado2g+cMNwKro8X9+yjPAfI2Bd0pYNqnEi waWtpmtiK7soNHH7AFuiazOY3gKXI/D0Uh5x1fCcshdGrumRe+VteZ7aeQ3HmleffDat o5sGwGwpnGJhyCi44Wc3i+KDFdrJqD3hxSQh9rea+Fkl0nUqCQ271wNb7+PmRMZphGj0 921U5gU1fttWz9kDnYDX/Xbl8bmgdFuHmJwpAas7/9fv/tyKVFj2fsINRvGz+np7mDXG b3LQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a50ed96000000b00412b31c54ccsi1813239edr.169.2022.02.25.04.06.10; Fri, 25 Feb 2022 04:06:33 -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; 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 S239232AbiBYJsK (ORCPT + 99 others); Fri, 25 Feb 2022 04:48:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237986AbiBYJsJ (ORCPT ); Fri, 25 Feb 2022 04:48:09 -0500 Received: from smtpproxy21.qq.com (smtpbg703.qq.com [203.205.195.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75E219140F for ; Fri, 25 Feb 2022 01:47:36 -0800 (PST) X-QQ-mid: bizesmtp69t1645782450t0kbe8hh Received: from localhost.localdomain (unknown [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 25 Feb 2022 17:47:24 +0800 (CST) X-QQ-SSF: 01400000002000C0F000000A0000000 X-QQ-FEAT: vsfsx1ezZ8T9jEj1xNfTc/NNOY+XLDtQ8KYfXZfbFq1OAyvxyybatFq69W8AI mycbPgvMN1QnO8/m3gZ4MXNE0Zk+9eIzUD8kDpcX4/3m0fuYQ1g3dyoYAnSaGiXEl3fj6HF Km8scUlBVEan0JXqC0YQjUEIv+KBhB2DCtPGymk80N91YFlBGLQEvDJrWy39/796K1qPCVo khjMPwmDue14T9tCbafeiSZU4SIUKbVJYPzTUUtsJitFFd2u/qoW0Q/W4Ir/CiC7S1lWgxU hQ3WedHzT9K7OtW/iRZ8aTvg9APS/5NBzkWNrRTQe9cg0PEDaogOItAu/D5uXmJR5xDa+hJ qkd9CQSAwDFbvgrIHt/V9YHcl4/IX7b4dN7hOQoCBap8M7kzcg= X-QQ-GoodBg: 1 From: Meng Tang To: airlied@linux.ie, daniel@ffwll.ch Cc: evan.quan@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Meng Tang Subject: [PATCH] gpu/amd: vega10_hwmgr: fix inappropriate private variable name Date: Fri, 25 Feb 2022 17:47:22 +0800 Message-Id: <20220225094722.4734-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 In file vega10_hwmgr.c, the names of struct vega10_power_state * and struct pp_power_state * are confusingly used, which may lead to some confusion. Status quo is that variables of type struct vega10_power_state * are named "vega10_ps", "ps", "vega10_power_state". A more appropriate usage is that struct are named "ps" is used for variabled of type struct pp_power_state *. So rename struct vega10_power_state * which are named "ps" and "vega10_power_state" to "vega10_ps", I also renamed "psa" to "vega10_psa" and "psb" to "vega10_psb" to make it more clearly. The rows longer than 100 columns are involved. Signed-off-by: Meng Tang --- .../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 68 +++++++++++-------- 1 file changed, 38 insertions(+), 30 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 3f040be0d158..37324f2009ca 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c @@ -3095,7 +3095,7 @@ static int vega10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, void *pp_table, uint32_t classification_flag) { ATOM_Vega10_GFXCLK_Dependency_Record_V2 *patom_record_V2; - struct vega10_power_state *vega10_power_state = + struct vega10_power_state *vega10_ps = cast_phw_vega10_power_state(&(power_state->hardware)); struct vega10_performance_level *performance_level; ATOM_Vega10_State *state_entry = (ATOM_Vega10_State *)state; @@ -3145,17 +3145,17 @@ static int vega10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, power_state->temperatures.min = 0; power_state->temperatures.max = 0; - performance_level = &(vega10_power_state->performance_levels - [vega10_power_state->performance_level_count++]); + performance_level = &(vega10_ps->performance_levels + [vega10_ps->performance_level_count++]); PP_ASSERT_WITH_CODE( - (vega10_power_state->performance_level_count < + (vega10_ps->performance_level_count < NUM_GFXCLK_DPM_LEVELS), "Performance levels exceeds SMC limit!", return -1); PP_ASSERT_WITH_CODE( - (vega10_power_state->performance_level_count <= + (vega10_ps->performance_level_count <= hwmgr->platform_descriptor. hardwareActivityPerformanceLevels), "Performance levels exceeds Driver limit!", @@ -3169,8 +3169,8 @@ static int vega10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, performance_level->mem_clock = mclk_dep_table->entries [state_entry->ucMemClockIndexLow].ulMemClk; - performance_level = &(vega10_power_state->performance_levels - [vega10_power_state->performance_level_count++]); + performance_level = &(vega10_ps->performance_levels + [vega10_ps->performance_level_count++]); performance_level->soc_clock = socclk_dep_table->entries [state_entry->ucSocClockIndexHigh].ulClk; if (gfxclk_dep_table->ucRevId == 0) { @@ -3201,11 +3201,11 @@ static int vega10_get_pp_table_entry(struct pp_hwmgr *hwmgr, unsigned long entry_index, struct pp_power_state *state) { int result; - struct vega10_power_state *ps; + struct vega10_power_state *vega10_ps; state->hardware.magic = PhwVega10_Magic; - ps = cast_phw_vega10_power_state(&state->hardware); + vega10_ps = cast_phw_vega10_power_state(&state->hardware); result = vega10_get_powerplay_table_entry(hwmgr, entry_index, state, vega10_get_pp_table_entry_callback_func); @@ -3218,10 +3218,10 @@ static int vega10_get_pp_table_entry(struct pp_hwmgr *hwmgr, */ /* set DC compatible flag if this state supports DC */ if (!state->validation.disallowOnDC) - ps->dc_compatible = true; + vega10_ps->dc_compatible = true; - ps->uvd_clks.vclk = state->uvd_clocks.VCLK; - ps->uvd_clks.dclk = state->uvd_clocks.DCLK; + vega10_ps->uvd_clks.vclk = state->uvd_clocks.VCLK; + vega10_ps->uvd_clks.dclk = state->uvd_clocks.DCLK; return 0; } @@ -4823,33 +4823,41 @@ static int vega10_check_states_equal(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *pstate1, const struct pp_hw_power_state *pstate2, bool *equal) { - const struct vega10_power_state *psa; - const struct vega10_power_state *psb; + const struct vega10_power_state *vega10_psa; + const struct vega10_power_state *vega10_psb; int i; if (pstate1 == NULL || pstate2 == NULL || equal == NULL) return -EINVAL; - psa = cast_const_phw_vega10_power_state(pstate1); - psb = cast_const_phw_vega10_power_state(pstate2); - /* If the two states don't even have the same number of performance levels they cannot be the same state. */ - if (psa->performance_level_count != psb->performance_level_count) { + vega10_psa = cast_const_phw_vega10_power_state(pstate1); + vega10_psb = cast_const_phw_vega10_power_state(pstate2); + + /* If the two states don't even have the same number of performance levels + * they cannot be the same state. + */ + if (vega10_psa->performance_level_count != vega10_psb->performance_level_count) { *equal = false; return 0; } - for (i = 0; i < psa->performance_level_count; i++) { - if (!vega10_are_power_levels_equal(&(psa->performance_levels[i]), &(psb->performance_levels[i]))) { - /* If we have found even one performance level pair that is different the states are different. */ + for (i = 0; i < vega10_psa->performance_level_count; i++) { + if (!vega10_are_power_levels_equal(&(vega10_psa->performance_levels[i]), + &(vega10_psb->performance_levels[i]))) { + /* If we have found even one performance level pair + * that is different the states are different. + */ *equal = false; return 0; } } /* If all performance levels are the same try to use the UVD clocks to break the tie.*/ - *equal = ((psa->uvd_clks.vclk == psb->uvd_clks.vclk) && (psa->uvd_clks.dclk == psb->uvd_clks.dclk)); - *equal &= ((psa->vce_clks.evclk == psb->vce_clks.evclk) && (psa->vce_clks.ecclk == psb->vce_clks.ecclk)); - *equal &= (psa->sclk_threshold == psb->sclk_threshold); + *equal = ((vega10_psa->uvd_clks.vclk == vega10_psb->uvd_clks.vclk) && + (vega10_psa->uvd_clks.dclk == vega10_psb->uvd_clks.dclk)); + *equal &= ((vega10_psa->vce_clks.evclk == vega10_psb->vce_clks.evclk) && + (vega10_psa->vce_clks.ecclk == vega10_psb->vce_clks.ecclk)); + *equal &= (vega10_psa->sclk_threshold == vega10_psb->sclk_threshold); return 0; } @@ -5444,19 +5452,19 @@ static int vega10_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_ PHM_PerformanceLevelDesignation designation, uint32_t index, PHM_PerformanceLevel *level) { - const struct vega10_power_state *ps; + const struct vega10_power_state *vega10_ps; uint32_t i; if (level == NULL || hwmgr == NULL || state == NULL) return -EINVAL; - ps = cast_const_phw_vega10_power_state(state); + vega10_ps = cast_const_phw_vega10_power_state(state); - i = index > ps->performance_level_count - 1 ? - ps->performance_level_count - 1 : index; + i = index > vega10_ps->performance_level_count - 1 ? + vega10_ps->performance_level_count - 1 : index; - level->coreClock = ps->performance_levels[i].gfx_clock; - level->memory_clock = ps->performance_levels[i].mem_clock; + level->coreClock = vega10_ps->performance_levels[i].gfx_clock; + level->memory_clock = vega10_ps->performance_levels[i].mem_clock; return 0; } -- 2.20.1