> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of Jacek Kowalski
> Sent: Wednesday, July 23, 2025 10:55 AM
> To: Nguyen, Anthony L <[email protected]>; Kitszel,
> Przemyslaw <[email protected]>; Andrew Lunn
> <[email protected]>; David S. Miller <[email protected]>; Eric
> Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo
> Abeni <[email protected]>; Simon Horman <[email protected]>
> Cc: [email protected]; [email protected]
> Subject: [Intel-wired-lan] [PATCH iwl-next v3 3/5] igb: drop
> unnecessary constant casts to u16
> 
> Remove unnecessary casts of constant values to u16.
> C's integer promotion rules make them ints no matter what.
> 
> Additionally replace IGB_MNG_VLAN_NONE with resulting value rather
> than casting -1 to u16.
> 
> Signed-off-by: Jacek Kowalski <[email protected]>
> Suggested-by: Simon Horman <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
> ---
>  drivers/net/ethernet/intel/igb/e1000_82575.c | 4 ++--
> drivers/net/ethernet/intel/igb/e1000_i210.c  | 2 +-
>  drivers/net/ethernet/intel/igb/e1000_nvm.c   | 4 ++--
>  drivers/net/ethernet/intel/igb/igb.h         | 2 +-
>  drivers/net/ethernet/intel/igb/igb_main.c    | 3 +--
>  5 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c
> b/drivers/net/ethernet/intel/igb/e1000_82575.c
> index 64dfc362d1dc..44a85ad749a4 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_82575.c
> +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
> @@ -2372,7 +2372,7 @@ static s32
> igb_validate_nvm_checksum_with_offset(struct e1000_hw *hw,
>               checksum += nvm_data;
>       }
> 
> -     if (checksum != (u16) NVM_SUM) {
> +     if (checksum != NVM_SUM) {
>               hw_dbg("NVM Checksum Invalid\n");
>               ret_val = -E1000_ERR_NVM;
>               goto out;
> @@ -2406,7 +2406,7 @@ static s32
> igb_update_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
>               }
>               checksum += nvm_data;
>       }
> -     checksum = (u16) NVM_SUM - checksum;
> +     checksum = NVM_SUM - checksum;
>       ret_val = hw->nvm.ops.write(hw, (NVM_CHECKSUM_REG + offset), 1,
>                               &checksum);
>       if (ret_val)
> diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c
> b/drivers/net/ethernet/intel/igb/e1000_i210.c
> index 503b239868e8..9db29b231d6a 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_i210.c
> +++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
> @@ -602,7 +602,7 @@ static s32 igb_update_nvm_checksum_i210(struct
> e1000_hw *hw)
>                       }
>                       checksum += nvm_data;
>               }
> -             checksum = (u16) NVM_SUM - checksum;
> +             checksum = NVM_SUM - checksum;
>               ret_val = igb_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1,
>                                               &checksum);
>               if (ret_val) {
> diff --git a/drivers/net/ethernet/intel/igb/e1000_nvm.c
> b/drivers/net/ethernet/intel/igb/e1000_nvm.c
> index 2dcd64d6dec3..c8638502c2be 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_nvm.c
> +++ b/drivers/net/ethernet/intel/igb/e1000_nvm.c
> @@ -636,7 +636,7 @@ s32 igb_validate_nvm_checksum(struct e1000_hw *hw)
>               checksum += nvm_data;
>       }
> 
> -     if (checksum != (u16) NVM_SUM) {
> +     if (checksum != NVM_SUM) {
>               hw_dbg("NVM Checksum Invalid\n");
>               ret_val = -E1000_ERR_NVM;
>               goto out;
> @@ -668,7 +668,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
>               }
>               checksum += nvm_data;
>       }
> -     checksum = (u16) NVM_SUM - checksum;
> +     checksum = NVM_SUM - checksum;
>       ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1,
> &checksum);
>       if (ret_val)
>               hw_dbg("NVM Write Error while updating checksum.\n");
> diff --git a/drivers/net/ethernet/intel/igb/igb.h
> b/drivers/net/ethernet/intel/igb/igb.h
> index c3f4f7cd264e..0fff1df81b7b 100644
> --- a/drivers/net/ethernet/intel/igb/igb.h
> +++ b/drivers/net/ethernet/intel/igb/igb.h
> @@ -217,7 +217,7 @@ static inline int igb_skb_pad(void)
>  #define IGB_MASTER_SLAVE     e1000_ms_hw_default
>  #endif
> 
> -#define IGB_MNG_VLAN_NONE    -1
> +#define IGB_MNG_VLAN_NONE    0xFFFF
> 
>  enum igb_tx_flags {
>       /* cmd_type flags */
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c
> b/drivers/net/ethernet/intel/igb/igb_main.c
> index a9a7a94ae61e..5e63d7f6a568 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -1531,8 +1531,7 @@ static void igb_update_mng_vlan(struct
> igb_adapter *adapter)
>               adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
>       }
> 
> -     if ((old_vid != (u16)IGB_MNG_VLAN_NONE) &&
> -         (vid != old_vid) &&
> +     if (old_vid != IGB_MNG_VLAN_NONE && vid != old_vid &&
>           !test_bit(old_vid, adapter->active_vlans)) {
>               /* remove VID from filter table */
>               igb_vfta_set(hw, vid, pf_id, false, true);
> --
> 2.47.2

Reply via email to