* [PATCH] cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update
@ 2018-10-01 3:51 Nathan Chancellor
2018-10-02 22:54 ` Nick Desaulniers
2018-10-03 5:31 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2018-10-01 3:51 UTC (permalink / raw)
To: Ganesh Goudar, David S. Miller
Cc: netdev, linux-kernel, Nick Desaulniers, Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:303:7: warning: implicit
conversion from enumeration type 'enum cxgb4_dcb_state' to different
enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
? CXGB4_DCB_STATE_FW_ALLSYNCED
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:304:7: warning: implicit
conversion from enumeration type 'enum cxgb4_dcb_state' to different
enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
: CXGB4_DCB_STATE_FW_INCOMPLETE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
Use the equivalent value of the expected type to silence Clang while
resulting in no functional change.
CXGB4_DCB_STATE_FW_INCOMPLETE = CXGB4_DCB_INPUT_FW_INCOMPLETE = 2
CXGB4_DCB_STATE_FW_ALLSYNCED = CXGB4_DCB_INPUT_FW_ALLSYNCED = 3
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
index 6ba3104ff7eb..9bd5f755a0e0 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
@@ -300,8 +300,8 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap,
enum cxgb4_dcb_state_input input =
((pcmd->u.dcb.control.all_syncd_pkd &
FW_PORT_CMD_ALL_SYNCD_F)
- ? CXGB4_DCB_STATE_FW_ALLSYNCED
- : CXGB4_DCB_STATE_FW_INCOMPLETE);
+ ? CXGB4_DCB_INPUT_FW_ALLSYNCED
+ : CXGB4_DCB_INPUT_FW_INCOMPLETE);
if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) {
dcb_running_version = FW_PORT_CMD_DCB_VERSION_G(
--
2.19.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update
2018-10-01 3:51 [PATCH] cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update Nathan Chancellor
@ 2018-10-02 22:54 ` Nick Desaulniers
2018-10-03 5:31 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2018-10-02 22:54 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: ganeshgr, David S. Miller, netdev, LKML
On Sun, Sep 30, 2018 at 8:54 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns when one enumerated type is implicitly converted to another.
>
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:303:7: warning: implicit
> conversion from enumeration type 'enum cxgb4_dcb_state' to different
> enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
> ? CXGB4_DCB_STATE_FW_ALLSYNCED
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:304:7: warning: implicit
> conversion from enumeration type 'enum cxgb4_dcb_state' to different
> enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
> : CXGB4_DCB_STATE_FW_INCOMPLETE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 warnings generated.
>
> Use the equivalent value of the expected type to silence Clang while
> resulting in no functional change.
>
> CXGB4_DCB_STATE_FW_INCOMPLETE = CXGB4_DCB_INPUT_FW_INCOMPLETE = 2
> CXGB4_DCB_STATE_FW_ALLSYNCED = CXGB4_DCB_INPUT_FW_ALLSYNCED = 3
Yep looks good. There's not too many users of cxgb4_dcb_state_input
in the kernel. I wonder if it could even be replaced entirely with
cxgb4_dcb_state? But for now this patch fixes the warning correctly.
Thanks for sending it.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Looks like this was the second case of this warning in this code (I
thought I was having Deja Vu; that I had already reviewed this patch
earlier): https://lkml.org/lkml/2018/10/1/255 Probably could have been
a single patch, but that's ok.
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
> index 6ba3104ff7eb..9bd5f755a0e0 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
> @@ -300,8 +300,8 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap,
> enum cxgb4_dcb_state_input input =
> ((pcmd->u.dcb.control.all_syncd_pkd &
> FW_PORT_CMD_ALL_SYNCD_F)
> - ? CXGB4_DCB_STATE_FW_ALLSYNCED
> - : CXGB4_DCB_STATE_FW_INCOMPLETE);
> + ? CXGB4_DCB_INPUT_FW_ALLSYNCED
> + : CXGB4_DCB_INPUT_FW_INCOMPLETE);
>
> if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) {
> dcb_running_version = FW_PORT_CMD_DCB_VERSION_G(
> --
> 2.19.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update
2018-10-01 3:51 [PATCH] cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update Nathan Chancellor
2018-10-02 22:54 ` Nick Desaulniers
@ 2018-10-03 5:31 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-10-03 5:31 UTC (permalink / raw)
To: natechancellor; +Cc: ganeshgr, netdev, linux-kernel, ndesaulniers
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Sun, 30 Sep 2018 20:51:43 -0700
> Clang warns when one enumerated type is implicitly converted to another.
>
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:303:7: warning: implicit
> conversion from enumeration type 'enum cxgb4_dcb_state' to different
> enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
> ? CXGB4_DCB_STATE_FW_ALLSYNCED
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:304:7: warning: implicit
> conversion from enumeration type 'enum cxgb4_dcb_state' to different
> enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
> : CXGB4_DCB_STATE_FW_INCOMPLETE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 warnings generated.
>
> Use the equivalent value of the expected type to silence Clang while
> resulting in no functional change.
>
> CXGB4_DCB_STATE_FW_INCOMPLETE = CXGB4_DCB_INPUT_FW_INCOMPLETE = 2
> CXGB4_DCB_STATE_FW_ALLSYNCED = CXGB4_DCB_INPUT_FW_ALLSYNCED = 3
>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Applied to net-next.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-03 5:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 3:51 [PATCH] cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update Nathan Chancellor
2018-10-02 22:54 ` Nick Desaulniers
2018-10-03 5:31 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.