Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp606026pxm; Fri, 25 Feb 2022 15:00:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNl4gSHJ63vh9Qot3MBPLw79IVxWICr5rAYy/G3q/OozvwOvvRZ4tRP3KILL/CElCmz6eT X-Received: by 2002:a17:90a:8581:b0:1b2:7541:af6c with SMTP id m1-20020a17090a858100b001b27541af6cmr5400290pjn.48.1645830049691; Fri, 25 Feb 2022 15:00:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645830049; cv=none; d=google.com; s=arc-20160816; b=qOczkjMltjsAsExufO03u3PIdBXII/9WDrXOgelvAJdRN1CIMajfutgImNdBqbJ8HX Qr2+R9oJ4uPL099ea6ow/YtJmiuM4/egSnj5XTCcK/rYA0j8YKk+JVurIeIvAee6Rl4A 2e6FCtPdhivsmChXWbBCYDBHEXe7YaLmelz6oeCwsZhKae6MPjeD3FC/A6J9LIIRfzMI YzYKO7S88N++Wc1ocQ5vxbFJV45uhoQ9bxaZDFYygpBUT/SyTkxpSNI4wHyhqNioCE1B XzIn2bO6Tqu4+VYYUZP9Oqmo89JP5V5Db8Fixa/IVb6ofqmi0Kmadkyo3ZxfqqSguIQQ llhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Ko8qqQEVUil5TWFjZfqRwHEsMLuAIssU02AmVQdPBOw=; b=Az3iV3vAEYuBYZtfBuYXR4UOiC4KsjzQ8qXRCcAkI4ygp9NG9ixGdAtGvE5APIJ3i2 9hbNm+iFzKoYDwfMSiEU1bqTcKWz7UAW+ioHAiQaXEDHEPkukjGRO/bJTFLzmGYZUAXv Z/ddfJVRRUgIwPhqqOvsjWA9UQcuvfpWICidbfemyPAzI4OjOOMHaqyVkH695ot7ogU8 QgMmrb6siUNvh7BTyDlul9k5sNMrcMMDvclAMQn7TflEfU/sWvEbID+7aRjXgJQ3IXDa zWA7VRi1HacevNavoLUwY01PK7TBWdrm0Ci/wmtffayH+qOVJ6GCPy8qvO+CSN0F/7ti BYHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pGszxkCL; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a17090a688e00b001bc67269a6asi8411296pjd.175.2022.02.25.15.00.34; Fri, 25 Feb 2022 15:00:49 -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=pass header.i=@gmail.com header.s=20210112 header.b=pGszxkCL; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238174AbiBYVQ7 (ORCPT + 99 others); Fri, 25 Feb 2022 16:16:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiBYVQ6 (ORCPT ); Fri, 25 Feb 2022 16:16:58 -0500 Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45F711D304A for ; Fri, 25 Feb 2022 13:16:24 -0800 (PST) Received: by mail-oo1-xc2b.google.com with SMTP id k13-20020a4a948d000000b003172f2f6bdfso8161211ooi.1 for ; Fri, 25 Feb 2022 13:16:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ko8qqQEVUil5TWFjZfqRwHEsMLuAIssU02AmVQdPBOw=; b=pGszxkCLQ3puVUxsx62owzoe4FsnFHrgHXfZzjx3PsWQBzq8vGDnk6bIge3G16WDGM +W0ly4wRg2QDX+85iQJuJxRD/pZ8BBjRhZKF6WaYk9BR78am4cRa/Fl+hg3a27kaX3dT oixl5lr930/QhU2LemXNOOgLCA3hbD/Un9/BN1FEapSvvEgTKXIpnWlV23OyKo9vH8hG QURSCbNp2g3jkoLYVgLrLF7Ot0g1Dm8uVLGkKYqP4Yh31coeL9zxOwD7iOPeRYWbgpLd w7Wf6lc5ZK7U12kout/97lFa5Zxvu2jx99n4mF6AEzSroOdnBMNaOTdgvkPB9bVf8yGf 3cCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ko8qqQEVUil5TWFjZfqRwHEsMLuAIssU02AmVQdPBOw=; b=UMPZCMLexDQ7XUouNzWkqmQTWw7HMZwgHKJ89Vb8JFh0P3kO8/BGcmjkCLIgmgC6WM KcupGVOD1HnbDnKIoJ9AqOu8I2lYDVQcfmYq7pTJTRJ25hSkkeOACZQLa1Xw+i8aIhqo aRSheCoIjjZU6mIw7vvzSVM9+dkO6lgXtKowbYSIbzJbFNo1MpLB+lFKsHN8DCEl2xSj wBuCz7I4vX7ptz2K0Lh1luluO1LErRbDrxqWVi/KcYDGsIfzncASRWt9/sdVMcQHjcVb HxlrjLnLsW4fez0+o4DXjzNlmZ45q/pJvDAAH3wTMIlifEbR/UlEx9jnIhu8iOZTS3kp tW2Q== X-Gm-Message-State: AOAM533M6pA5ltrYOjIZNtCNG2JAkxk8IqfXhxBJ4Oev7ed0mJ4FlgIq JGoNZRDDB0Zdpv2rfBY6r6EbTuCB0dJBqdvsXt3ji4TT X-Received: by 2002:a05:6870:3e0d:b0:d3:fe6d:57c3 with SMTP id lk13-20020a0568703e0d00b000d3fe6d57c3mr2338969oab.225.1645823783588; Fri, 25 Feb 2022 13:16:23 -0800 (PST) MIME-Version: 1.0 References: <20220225094722.4734-1-tangmeng@uniontech.com> In-Reply-To: From: Alex Deucher Date: Fri, 25 Feb 2022 16:16:12 -0500 Message-ID: Subject: Re: [PATCH] gpu/amd: vega10_hwmgr: fix inappropriate private variable name To: "Quan, Evan" Cc: Meng Tang , "airlied@linux.ie" , "daniel@ffwll.ch" , "Pan, Xinhui" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" , "Deucher, Alexander" , "Koenig, Christian" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Applied. Thanks! Alex On Fri, Feb 25, 2022 at 8:04 AM Quan, Evan wrote: > > [AMD Official Use Only] > > Thanks! > The patch is reviewed-by: Evan Quan > > > -----Original Message----- > > From: Meng Tang > > Sent: Friday, February 25, 2022 5:47 PM > > To: airlied@linux.ie; daniel@ffwll.ch > > Cc: Quan, Evan ; Deucher, Alexander > > ; Koenig, Christian > > ; Pan, Xinhui ; 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 > > > > 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 > > > >