netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iwl-next v3 0/5] drop unnecessary constant casts to u16
@ 2025-07-23  8:53 Jacek Kowalski
  2025-07-23  8:54 ` [PATCH iwl-next v3 1/5] e1000: " Jacek Kowalski
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Jacek Kowalski @ 2025-07-23  8:53 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
  Cc: intel-wired-lan, netdev

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-08-08 13:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-23  8:53 [PATCH iwl-next v3 0/5] drop unnecessary constant casts to u16 Jacek Kowalski
2025-07-23  8:54 ` [PATCH iwl-next v3 1/5] e1000: " Jacek Kowalski
2025-07-23 10:06   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-08-08 13:44   ` Simon Horman
2025-07-23  8:54 ` [PATCH iwl-next v3 2/5] e1000e: " Jacek Kowalski
2025-07-23 10:07   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-08-08 13:44   ` Simon Horman
2025-07-23  8:55 ` [PATCH iwl-next v3 3/5] igb: " Jacek Kowalski
2025-07-23 10:08   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-08-08 11:34   ` Rinitha, SX
2025-08-08 13:44   ` Simon Horman
2025-07-23  8:55 ` [PATCH iwl-next v3 4/5] igc: " Jacek Kowalski
2025-07-23 10:09   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-08-08 13:44   ` Simon Horman
2025-07-23  8:55 ` [PATCH iwl-next v3 5/5] ixgbe: drop unnecessary casts to u16 / int Jacek Kowalski
2025-07-23 10:10   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-08-08  9:46   ` Rinitha, SX
2025-08-08 13:45   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).