From: "Kazlauskas, Nicholas" <Nicholas.Kazlauskas@amd.com>
To: "Li, Sun peng (Leo)" <Sunpeng.Li@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>,
"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
"Wentland, Harry" <Harry.Wentland@amd.com>,
Rex Zhu <rex.zhu@amd.com>, "Quan, Evan" <Evan.Quan@amd.com>
Cc: David Airlie <airlied@linux.ie>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"clang-built-linux@googlegroups.com"
<clang-built-linux@googlegroups.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
Nathan Chancellor <natechancellor@gmail.com>
Subject: Re: [PATCH 5/7] drm/amd/display: Use proper enum conversion functions
Date: Thu, 25 Jul 2019 16:14:25 +0000 [thread overview]
Message-ID: <18b343ab-8834-ea86-1bca-974f23b60b16@amd.com> (raw)
In-Reply-To: <5f0e8332-50ae-cc9c-1a12-5a097c51297d@amd.com>
On 7/25/19 12:00 PM, Li, Sun peng (Leo) wrote:
>
>
> On 2019-07-18 11:16 p.m., Nathan Chancellor wrote:
>> On Wed, Jul 03, 2019 at 10:52:16PM -0700, Nathan Chancellor wrote:
>>> clang warns:
>>>
>>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_pp_smu.c:336:8:
>>> warning: implicit conversion from enumeration type 'enum smu_clk_type'
>>> to different enumeration type 'enum amd_pp_clock_type'
>>> [-Wenum-conversion]
>>> dc_to_smu_clock_type(clk_type),
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_pp_smu.c:421:14:
>>> warning: implicit conversion from enumeration type 'enum
>>> amd_pp_clock_type' to different enumeration type 'enum smu_clk_type'
>>> [-Wenum-conversion]
>>> dc_to_pp_clock_type(clk_type),
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> There are functions to properly convert between all of these types, use
>>> them so there are no longer any warnings.
>>>
>>> Fixes: a43913ea50a5 ("drm/amd/powerplay: add function get_clock_by_type_with_latency for navi10")
>>> Fixes: e5e4e22391c2 ("drm/amd/powerplay: add interface to get clock by type with latency for display (v2)")
>>> Link: https://github.com/ClangBuiltLinux/linux/issues/586
>>> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
>>> ---
>>> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
>>> index eac09bfe3be2..0f76cfff9d9b 100644
>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
>>> @@ -333,7 +333,7 @@ bool dm_pp_get_clock_levels_by_type(
>>> }
>>> } else if (adev->smu.funcs && adev->smu.funcs->get_clock_by_type) {
>>> if (smu_get_clock_by_type(&adev->smu,
>>> - dc_to_smu_clock_type(clk_type),
>>> + dc_to_pp_clock_type(clk_type),
>
> smu_funcs->get_clock_by_type doesn't seem to be hooked up anywhere,
> so this looks to be the most correct.
>
> Although it makes more sense to use smu_clk_types here rather than
> amd_pp_clock_type - any reason why this isn't the case?
>
>>> &pp_clks)) {
>>> get_default_clock_levels(clk_type, dc_clks);
>>> return true;
>>> @@ -418,7 +418,7 @@ bool dm_pp_get_clock_levels_by_type_with_latency(
>>> return false;
>>> } else if (adev->smu.ppt_funcs && adev->smu.ppt_funcs->get_clock_by_type_with_latency) {
>>> if (smu_get_clock_by_type_with_latency(&adev->smu,
>>> - dc_to_pp_clock_type(clk_type),
>>> + dc_to_smu_clock_type(clk_type),
>
> This is slightly concerning. The functions are doing the right thing,
> but amd_pp_clock_type doesn't map 1-1 to smu_clk_type... In any case,
> this looks good to me.
>
> Reviewed-by: Leo Li <sunpeng.li@amd.com>
Looks mostly like the table just needs to be sized properly:
static int dc_clk_type_map[] = {
->
static int dc_clk_type_map[DM_PP_CLOCK_TYPE_NUM_TYPES] = {
where DM_PP_CLOCK_TYPE_NUM_TYPES would be added to enum dm_pp_clock_type.
Or it could just use a switch table instead, like the other function does.
Nicholas Kazlauskas
>
>>> &pp_clks))
>>> return false;
>>> }
>>> --
>>> 2.22.0
>>>
>>
>> Gentle ping for review, this is the last remaining warning that I see
>> from amdgpu on next-20190718.
>>
>> Cheers,
>> Nathan
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
next prev parent reply other threads:[~2019-07-25 16:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 5:52 [PATCH 0/7] amdgpu clang warning fixes on next-20190703 Nathan Chancellor
2019-07-04 5:52 ` [PATCH 1/7] drm/amdgpu/mes10.1: Fix header guard Nathan Chancellor
2019-07-08 20:24 ` Arnd Bergmann
2019-07-04 5:52 ` [PATCH 2/7] drm/amd/powerplay: Use memset to initialize metrics structs Nathan Chancellor
2019-07-04 5:52 ` [PATCH 3/7] drm/amd/powerplay: Use proper enums in smu_adjust_power_state_dynamic Nathan Chancellor
2019-07-04 5:52 ` [PATCH 4/7] drm/amd/powerplay: Zero initialize freq in smu_v11_0_get_current_clk_freq Nathan Chancellor
2019-07-04 5:52 ` [PATCH 5/7] drm/amd/display: Use proper enum conversion functions Nathan Chancellor
2019-07-09 18:51 ` Arnd Bergmann
2019-07-09 20:21 ` Nathan Chancellor
2019-07-19 3:16 ` Nathan Chancellor
2019-07-25 16:00 ` Li, Sun peng (Leo)
2019-07-25 16:14 ` Kazlauskas, Nicholas [this message]
2019-07-25 17:26 ` Li, Sun peng (Leo)
2019-07-04 5:52 ` [PATCH 6/7] drm/amd/powerplay: Use proper enums in vega20_print_clk_levels Nathan Chancellor
2019-07-15 9:25 ` Arnd Bergmann
2019-07-15 15:39 ` Nathan Chancellor
2019-07-16 1:00 ` Quan, Evan
2019-07-04 5:52 ` [PATCH 7/7] drm/amd/powerplay: Zero initialize current_rpm in vega20_get_fan_speed_percent Nathan Chancellor
2019-07-08 15:55 ` [PATCH 0/7] amdgpu clang warning fixes on next-20190703 Alex Deucher
2019-07-09 7:22 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18b343ab-8834-ea86-1bca-974f23b60b16@amd.com \
--to=nicholas.kazlauskas@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=David1.Zhou@amd.com \
--cc=Evan.Quan@amd.com \
--cc=Harry.Wentland@amd.com \
--cc=Sunpeng.Li@amd.com \
--cc=airlied@linux.ie \
--cc=amd-gfx@lists.freedesktop.org \
--cc=clang-built-linux@googlegroups.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=rex.zhu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).