linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] amdgpu/dc: Add missing cast in dce_clock_set_min_clocks_state()
@ 2018-02-09 21:28 Matthias Kaehlcke
  2018-02-09 21:55 ` Harry Wentland
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Kaehlcke @ 2018-02-09 21:28 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Zhou, David Airlie,
	Harry Wentland, Tony Cheng, Dmytro Laktyushkin
  Cc: amd-gfx, dri-devel, linux-kernel, Guenter Roeck, Justin TerAvest,
	Craig Bergstrom, Matthias Kaehlcke

dce_clock_set_min_clocks_state() assigns (intentionally) a value of type
'enum dm_pp_clocks_state' to a variable of type 'enum dm_pp_power_level'
without an explicit cast. This causes clang to raise the following
warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_clocks.c:308:4: error:
  implicit conversion from enumeration type 'enum dm_pp_clocks_state'
  to different enumeration type 'enum dm_pp_power_level' [-Werror,-Wenum-conversion]
    clocks_state };

Make the cast explicit.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
index 9e98a5f39a6d..db3ceb283255 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
@@ -304,7 +304,8 @@ static bool dce_clock_set_min_clocks_state(
 	enum dm_pp_clocks_state clocks_state)
 {
 	struct dm_pp_power_level_change_request level_change_req = {
-			clocks_state };
+		.power_level = (enum dm_pp_power_level)clocks_state
+	};
 
 	if (clocks_state > clk->max_clks_state) {
 		/*Requested state exceeds max supported state.*/
-- 
2.16.0.rc1.238.g530d649a79-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] amdgpu/dc: Add missing cast in dce_clock_set_min_clocks_state()
  2018-02-09 21:28 [PATCH] amdgpu/dc: Add missing cast in dce_clock_set_min_clocks_state() Matthias Kaehlcke
@ 2018-02-09 21:55 ` Harry Wentland
  2018-02-09 22:19   ` Matthias Kaehlcke
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Wentland @ 2018-02-09 21:55 UTC (permalink / raw)
  To: Matthias Kaehlcke, Alex Deucher, Christian König, David Zhou,
	David Airlie, Tony Cheng, Dmytro Laktyushkin
  Cc: amd-gfx, dri-devel, linux-kernel, Guenter Roeck, Justin TerAvest,
	Craig Bergstrom

On 2018-02-09 04:28 PM, Matthias Kaehlcke wrote:
> dce_clock_set_min_clocks_state() assigns (intentionally) a value of type
> 'enum dm_pp_clocks_state' to a variable of type 'enum dm_pp_power_level'
> without an explicit cast. This causes clang to raise the following
> warning:
> 
> drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_clocks.c:308:4: error:
>   implicit conversion from enumeration type 'enum dm_pp_clocks_state'
>   to different enumeration type 'enum dm_pp_power_level' [-Werror,-Wenum-conversion]
>     clocks_state };
> 
> Make the cast explicit.
> 
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
>  drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
> index 9e98a5f39a6d..db3ceb283255 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
> @@ -304,7 +304,8 @@ static bool dce_clock_set_min_clocks_state(
>  	enum dm_pp_clocks_state clocks_state)
>  {
>  	struct dm_pp_power_level_change_request level_change_req = {
> -			clocks_state };
> +		.power_level = (enum dm_pp_power_level)clocks_state

Thanks for spotting this. Looks like both enums are exactly the same so no need to keep both. I sent a patch to remove the dm_pp_power_level enum to amd-gfx and CC'd you on it.

Harry

> +	};
>  
>  	if (clocks_state > clk->max_clks_state) {
>  		/*Requested state exceeds max supported state.*/
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] amdgpu/dc: Add missing cast in dce_clock_set_min_clocks_state()
  2018-02-09 21:55 ` Harry Wentland
@ 2018-02-09 22:19   ` Matthias Kaehlcke
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Kaehlcke @ 2018-02-09 22:19 UTC (permalink / raw)
  To: Harry Wentland
  Cc: Alex Deucher, Christian König, David Zhou, David Airlie,
	Tony Cheng, Dmytro Laktyushkin, amd-gfx, dri-devel, linux-kernel,
	Guenter Roeck, Justin TerAvest, Craig Bergstrom

El Fri, Feb 09, 2018 at 04:55:57PM -0500 Harry Wentland ha dit:

> On 2018-02-09 04:28 PM, Matthias Kaehlcke wrote:
> > dce_clock_set_min_clocks_state() assigns (intentionally) a value of type
> > 'enum dm_pp_clocks_state' to a variable of type 'enum dm_pp_power_level'
> > without an explicit cast. This causes clang to raise the following
> > warning:
> > 
> > drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_clocks.c:308:4: error:
> >   implicit conversion from enumeration type 'enum dm_pp_clocks_state'
> >   to different enumeration type 'enum dm_pp_power_level' [-Werror,-Wenum-conversion]
> >     clocks_state };
> > 
> > Make the cast explicit.
> > 
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> >  drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
> > index 9e98a5f39a6d..db3ceb283255 100644
> > --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
> > +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
> > @@ -304,7 +304,8 @@ static bool dce_clock_set_min_clocks_state(
> >  	enum dm_pp_clocks_state clocks_state)
> >  {
> >  	struct dm_pp_power_level_change_request level_change_req = {
> > -			clocks_state };
> > +		.power_level = (enum dm_pp_power_level)clocks_state
> 
> Thanks for spotting this. Looks like both enums are exactly the same so no need to keep both. I sent a patch to remove the dm_pp_power_level enum to amd-gfx and CC'd you on it.

Even better, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-09 22:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 21:28 [PATCH] amdgpu/dc: Add missing cast in dce_clock_set_min_clocks_state() Matthias Kaehlcke
2018-02-09 21:55 ` Harry Wentland
2018-02-09 22:19   ` Matthias Kaehlcke

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).