drm/amd/display: Change status's type in aux_reply_transaction_data
Subsystems (3)
PATCH 1/1 drm/amd/display: Change status's type in aux_reply_transaction_data
Clang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enum aux_channel_operation_result' to different enumeration type 'enum aux_transaction_reply' [-Wenum-conversion]
reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enum aux_channel_operation_result' to different enumeration type 'enum aux_transaction_reply' [-Wenum-conversion]
reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Instead of implicitly or explicitly converting between types, just change status to type uint8_t (since its max size is 255) which avoids this construct altogether.
--- drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +1 -1
@@ -79,7 +79,7 @@ enum aux_transaction_reply { };struct aux_reply_transaction_data { -enum aux_transaction_reply status; +uint8_t status;uint32_t length;uint8_t *data; };
Signature · 1 line
2.19.0
Quoted 7 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]
Quoted 8 lines
reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I think the enum is actually wrong here. I think the correct fix would be:
- reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
+ reply->status = AUX_TRANSACTION_REPLY_HPD_DISCON;
The identifiers are so similar, my guess was that it was easy to mix them up. This looks like an actual bug to me, since the identifiers have different values between the 2 different enums.
Quoted 27 lines
Instead of implicitly or explicitly converting between types, just change status to type
uint8_t(since its max size is 255) which avoids this construct altogether.Reported-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +1
-2@@ -79,7 +79,7 @@ enum aux_transaction_reply { };struct aux_reply_transaction_data { -enum aux_transaction_reply status; +uint8_t status;uint32_t length;uint8_t *data; }; --2.19.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 23 lines · Nick Desaulniers
Quoted 7 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]Quoted 8 lines
reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I think the enum is actually wrong here. I think the correct fix would be:
(quoted diff) +1
-1- reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; + reply->status = AUX_TRANSACTION_REPLY_HPD_DISCON;
Quoted 4 lines
The identifiers are so similar, my guess was that it was easy to mix them up. This looks like an actual bug to me, since the identifiers have different values between the 2 different enums.
Hmmm interesting... I will be happy to send a v2 with your suggestion if one of the maintainers could confirm that to be the case (given DRM code is rather dense).
Thanks for the review!
Nathan
Quoted 32 lines
Quoted 27 lines
Instead of implicitly or explicitly converting between types, just change status to type
uint8_t(since its max size is 255) which avoids this construct altogether.Reported-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +1
-2@@ -79,7 +79,7 @@ enum aux_transaction_reply { };struct aux_reply_transaction_data { -enum aux_transaction_reply status; +uint8_t status;uint32_t length;uint8_t *data; }; --2.19.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Harry Wentland
maintainerQuoted 24 lines · Nathan Chancellor
Quoted 23 lines · Nick Desaulniers
Quoted 7 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]Quoted 8 lines
reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I think the enum is actually wrong here. I think the correct fix would be:
(quoted diff) +1
-1- reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; + reply->status = AUX_TRANSACTION_REPLY_HPD_DISCON;
Quoted 9 lines
Quoted 4 lines
The identifiers are so similar, my guess was that it was easy to mix them up. This looks like an actual bug to me, since the identifiers have different values between the 2 different enums.
Hmmm interesting... I will be happy to send a v2 with your suggestion if one of the maintainers could confirm that to be the case (given DRM code is rather dense).
Nick is correct. We should keep the enum but assign AUX_TRANSACTION_REPLY_HPD_DISCON in dce_aux.c and aux_engine_dce110.c.
Thanks for spotting this.
Harry
Quoted 35 lines
Thanks for the review!
NathanQuoted 32 lines
Quoted 27 lines
Instead of implicitly or explicitly converting between types, just change status to type
uint8_t(since its max size is 255) which avoids this construct altogether.Reported-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +1
-2@@ -79,7 +79,7 @@ enum aux_transaction_reply { };struct aux_reply_transaction_data { -enum aux_transaction_reply status; +uint8_t status;uint32_t length;uint8_t *data; }; --2.19.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v2 1/1 drm/amd/display: Use proper enums in process_channel_reply
In reply to Nathan ChancellorClang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enum aux_channel_operation_result' to different enumeration type 'enum aux_transaction_reply' [-Wenum-conversion]
reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enum aux_channel_operation_result' to different enumeration type 'enum aux_transaction_reply' [-Wenum-conversion]
reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The current enum is incorrect, it should be from aux_transaction_reply, so use AUX_TRANSACTION_REPLY_HPD_DISCON.
---
v1 -> v2:
* Rather than change status to an integer, use the proper enumerated type from aux_transaction reply as suggested by Nick and confirmed by Henry.
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 2 +- .../gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1 -1
@@ -312,7 +312,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; }
drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c +1 -1
@@ -346,7 +346,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; }
Signature · 1 line
2.19.0
Re: [PATCH v2] drm/amd/display: Use proper enums in process_channel_reply
Quoted 21 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The current enum is incorrect, it should be from
aux_transaction_reply, so useAUX_TRANSACTION_REPLY_HPD_DISCON.Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>
Quoted 7 lines
---
v1 -> v2:
* Rather than change status to an integer, use the proper enumerated type from
aux_transactionreply as suggested by Nick and confirmed by Henry.
Sigh Harry, sorry...
Quoted 34 lines
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 2 +- .../gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1
-1@@ -312,7 +312,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; }drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c +1
-1@@ -346,7 +346,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; }Signature · 1 line
2.19.0
Nick Desaulniers
Reviewed-byRe: [PATCH v2] drm/amd/display: Use proper enums in process_channel_reply
Quoted 17 lines · Nathan Chancellor
Quoted 15 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 6 lines
The current enum is incorrect, it should be from
aux_transaction_reply, so useAUX_TRANSACTION_REPLY_HPD_DISCON.Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>
Quoted 9 lines
Quoted 7 lines
---
v1 -> v2:
* Rather than change status to an integer, use the proper enumerated type from
aux_transactionreply as suggested by Nick and confirmed by Henry.Sigh Harry, sorry...
Thanks for the patch, Nathan. Don't worry about sending a v3 over this; its below the commit line so this detail wont get committed.
Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 2 +- .../gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1
-1@@ -312,7 +312,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; }drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c +1
-2@@ -346,7 +346,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; } --2.19.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Re: [PATCH v2] drm/amd/display: Use proper enums in process_channel_reply
Quoted 19 lines · Nick Desaulniers
Quoted 17 lines · Nathan Chancellor
Quoted 15 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
warning: implicit conversion from enumeration type 'enumaux_channel_operation_result' to different enumeration type 'enumaux_transaction_reply' [-Wenum-conversion]reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
The current enum is incorrect, it should be from
aux_transaction_reply, so useAUX_TRANSACTION_REPLY_HPD_DISCON.Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>Reviewed-by Nick Desaulniers <[email protected]>
Pulling it in through amd-staging-drm-next.
Quoted 11 lines
Quoted 10 lines
Quoted 8 lines
---
v1 -> v2:
* Rather than change status to an integer, use the proper enumerated type from
aux_transactionreply as suggested by Nick and confirmed by Henry.Sigh Harry, sorry...
No worries. You're not the first to get that wrong. :)
Harry
Quoted 35 lines
Thanks for the patch, Nathan. Don't worry about sending a v3 over this; its below the commit line so this detail wont get committed.
Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 2 +- .../gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1
-1@@ -312,7 +312,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; }drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c +1
-1@@ -346,7 +346,7 @@ static void process_channel_reply(/* in case HPD is LOW, exit AUX transaction */ if ((sw_status &AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK )) { - reply->status =AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON ; + reply->status =AUX_TRANSACTION_REPLY_HPD_DISCON ;return ; }
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
--
2.19.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel