diff mbox series

cxgb4: Use proper enum in IEEE_FAUX_SYNC

Message ID 20181001034738.29475-1-natechancellor@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series cxgb4: Use proper enum in IEEE_FAUX_SYNC | expand

Commit Message

Nathan Chancellor Oct. 1, 2018, 3:47 a.m. UTC
Clang warns when one enumerated type is implicitly converted to another.

drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:390:4: warning: implicit
conversion from enumeration type 'enum cxgb4_dcb_state' to different
enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
                        IEEE_FAUX_SYNC(dev, dcb);
                        ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h:70:10: note: expanded
from macro 'IEEE_FAUX_SYNC'
                                            CXGB4_DCB_STATE_FW_ALLSYNCED);
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use the equivalent value of the expected type to silence Clang while
resulting in no functional change.

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.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nick Desaulniers Oct. 1, 2018, 10:50 p.m. UTC | #1
On Sun, Sep 30, 2018 at 8:47 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:390:4: warning: implicit
> conversion from enumeration type 'enum cxgb4_dcb_state' to different
> enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]

Luckily these 2 enums had the same values, so this change is no
functional change.  Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>                         IEEE_FAUX_SYNC(dev, dcb);
>                         ^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h:70:10: note: expanded
> from macro 'IEEE_FAUX_SYNC'
>                                             CXGB4_DCB_STATE_FW_ALLSYNCED);
>                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Use the equivalent value of the expected type to silence Clang while
> resulting in no functional change.
>
> 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.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
> index 02040b99c78a..484ee8290090 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
> @@ -67,7 +67,7 @@
>         do { \
>                 if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \
>                         cxgb4_dcb_state_fsm((__dev), \
> -                                           CXGB4_DCB_STATE_FW_ALLSYNCED); \
> +                                           CXGB4_DCB_INPUT_FW_ALLSYNCED); \
>         } while (0)
>
>  /* States we can be in for a port's Data Center Bridging.
> --
> 2.19.0
>
David Miller Oct. 3, 2018, 5:31 a.m. UTC | #2
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Sun, 30 Sep 2018 20:47:38 -0700

> Clang warns when one enumerated type is implicitly converted to another.
> 
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c:390:4: warning: implicit
> conversion from enumeration type 'enum cxgb4_dcb_state' to different
> enumeration type 'enum cxgb4_dcb_state_input' [-Wenum-conversion]
>                         IEEE_FAUX_SYNC(dev, dcb);
>                         ^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h:70:10: note: expanded
> from macro 'IEEE_FAUX_SYNC'
>                                             CXGB4_DCB_STATE_FW_ALLSYNCED);
>                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Use the equivalent value of the expected type to silence Clang while
> resulting in no functional change.
> 
> CXGB4_DCB_STATE_FW_ALLSYNCED = CXGB4_DCB_INPUT_FW_ALLSYNCED = 3
> 
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Applied to net-next.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
index 02040b99c78a..484ee8290090 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
@@ -67,7 +67,7 @@ 
 	do { \
 		if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \
 			cxgb4_dcb_state_fsm((__dev), \
-					    CXGB4_DCB_STATE_FW_ALLSYNCED); \
+					    CXGB4_DCB_INPUT_FW_ALLSYNCED); \
 	} while (0)
 
 /* States we can be in for a port's Data Center Bridging.