Skip to contentSkip to conversation

drm/amd/display: remove conversion to bool in dcn20_mpc.c

PATCH Applied Jason Yan 4 participants 4 messages Apr 27, 2020

Subsystems (3)
lore
Share & tools
lore

Jason Yan

author
#0 lore raw

PATCH 1/1 drm/amd/display: remove conversion to bool in dcn20_mpc.c

The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning:

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c:455:70-75: WARNING:
conversion to bool not needed here

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +1 -1
index de9c857ab3e9..9d7432f3fb16 100644
@@ -452,7 +452,7 @@ void mpc2_set_output_gamma(
 		next_mode = LUT_RAM_A;
 
 	mpc20_power_on_ogam_lut(mpc, mpcc_id, true);
-	mpc20_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A ? true:false);
+	mpc20_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A);
 
 	if (next_mode == LUT_RAM_A)
 		mpc2_program_luta(mpc, mpcc_id, params);
Signature · 1 line
2.21.1
#1 lore raw
Quoted 1 line · Jason Yan

The '==' expression itself is bool, no need to convert it to bool again.

trivia:

These descriptions are not quite correct.
The operators return an int, either 0 or 1.

-----------------
6.5.8 Relational operators

6 Each of the operators < (less than), > (greater than), <= (less than or equal to), and >= (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false. 90) The result has type int

6.5.9 Equality operators

3 The == (equal to) and != (not equal to) operators are analogous to the relational operators except for their lower precedence. 91) Each of the operators yields 1 if the specified relation is true and 0 if it is false. The result has type int. For any pair of operands, exactly one of the relations is true.
-----------------

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Jason Yan

Am 27.04.20 um 08:37 schrieb Jason Yan:

Quoted 7 lines

The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning:

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c:455:70-75: WARNING:
conversion to bool not needed here

Quoted 9 lines
---
  drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +0 -0
index de9c857ab3e9..9d7432f3fb16 100644

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c void mpc2_set_output_gamma( · line 458

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +1 -1
@@ -452,7 +452,7 @@ void mpc2_set_output_gamma(
  		next_mode = LUT_RAM_A;
 
  	mpc20_power_on_ogam_lut(mpc, mpcc_id, true);
-	mpc20_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A ? true:false);
+	mpc20_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A);
 
  	if (next_mode == LUT_RAM_A)
  		mpc2_program_luta(mpc, mpcc_id, params);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Applied
#3 lore raw

Applied. Thanks!

Alex

Quoted 27 lines · Christian König

Am 27.04.20 um 08:37 schrieb Jason Yan:

Quoted 7 lines

The '==' expression itself is bool, no need to convert it to bool again. This fixes the following coccicheck warning:

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c:455:70-75: WARNING:
conversion to bool not needed here

Quoted 15 lines
---
  drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +1 -1
index de9c857ab3e9..9d7432f3fb16 100644
@@ -452,7 +452,7 @@ void mpc2_set_output_gamma(
              next_mode = LUT_RAM_A;
 
      mpc20_power_on_ogam_lut(mpc, mpcc_id, true);
-     mpc20_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A ? true:false);
+     mpc20_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A);
 
Quoted 7 lines

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c void mpc2_set_output_gamma( · line 458

Quoted 2 lines
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +0 -0
      if (next_mode == LUT_RAM_A)
              mpc2_program_luta(mpc, mpcc_id, params);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel