[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f87d6e9-9eb6-4532-8a1d-c88e91aac563@jacekk.info>
Date: Wed, 23 Jul 2025 10:53:28 +0200
From: Jacek Kowalski <jacek@...ekk.info>
To: Tony Nguyen <anthony.l.nguyen@...el.com>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>
Cc: intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org
Subject: [PATCH iwl-next v3 0/5] drop unnecessary constant casts to u16
As requested by Simon Horman, here's the patch set to drop casts of
constants to u16 in comparisons and subtractions. Changes are applied
across all Intel wired drivers.
Per C language specification, arithmetic types with rank lower than integer
are automatically promoted to at least (signed/unsigned) int on comparisons
and subtractions. There is no point in casting to types smaller than
integer, i.e. u16, in such code paths.
Additionally:
- drop casts in "return (int)checksum;" where checksum is u16,
- *_MNG_VLAN_NONE constants equal to -1 that are cast to (u16)
are now set to 0xFFFF.
v1 -> v2: drop casts in subtractions as well
v2 -> v3: update descs, rework *_MNG_VLAN_NONE, drop parentheses
Jacek Kowalski (5):
e1000: drop unnecessary constant casts to u16
e1000e: drop unnecessary constant casts to u16
igb: drop unnecessary constant casts to u16
igc: drop unnecessary constant casts to u16
ixgbe: drop unnecessary casts to u16 / int
drivers/net/ethernet/intel/e1000/e1000.h | 2 +-
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 2 +-
drivers/net/ethernet/intel/e1000/e1000_hw.c | 4 ++--
drivers/net/ethernet/intel/e1000/e1000_main.c | 3 +--
drivers/net/ethernet/intel/e1000e/e1000.h | 2 +-
drivers/net/ethernet/intel/e1000e/ethtool.c | 2 +-
drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
drivers/net/ethernet/intel/e1000e/nvm.c | 4 ++--
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 +--
drivers/net/ethernet/intel/igc/igc_i225.c | 2 +-
drivers/net/ethernet/intel/igc/igc_nvm.c | 4 ++--
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 4 ++--
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 4 ++--
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 4 ++--
18 files changed, 27 insertions(+), 29 deletions(-)
--
2.47.2
Powered by blists - more mailing lists