netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/8] net: stmmac: hwif.c cleanups
@ 2025-10-23  9:36 Russell King (Oracle)
  2025-10-23  9:37 ` [PATCH net-next 1/8] net: stmmac: move version handling into own function Russell King (Oracle)
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Russell King (Oracle) @ 2025-10-23  9:36 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, Paolo Abeni, Richard Cochran

Hi,

This series cleans up hwif.c:

- move the reading of the version information out of stmmac_hwif_init()
  into its own function, stmmac_get_version(), storing the result in a
  new struct.

- simplify stmmac_get_version().

- read the version register once, passing it to stmmac_get_id() and
  stmmac_get_dev_id().

- move stmmac_get_id() and stmmac_get_dev_id() into
  stmmac_get_version()

- define version register fields and use FIELD_GET() to decode

- start tackling the big loop in stmmac_hwif_init() - provide a
  function, stmmac_hwif_find(), which looks up the hwif entry, thus
  making a much smaller loop, which improves readability of this code.

- change the use of '^' to '!=' when comparing the dev_id, which is
  what is really meant here.

- reorganise the test after calling stmmac_hwif_init() so that we
  handle the error case in the indented code, and the success case
  with no indent, which is the classical arrangement.

 drivers/net/ethernet/stmicro/stmmac/common.h |   3 +
 drivers/net/ethernet/stmicro/stmmac/hwif.c   | 166 +++++++++++++++------------
 2 files changed, 98 insertions(+), 71 deletions(-)
 
-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

end of thread, other threads:[~2025-10-24 11:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23  9:36 [PATCH net-next 0/8] net: stmmac: hwif.c cleanups Russell King (Oracle)
2025-10-23  9:37 ` [PATCH net-next 1/8] net: stmmac: move version handling into own function Russell King (Oracle)
2025-10-23 18:44   ` Andrew Lunn
2025-10-23  9:37 ` [PATCH net-next 2/8] net: stmmac: simplify stmmac_get_version() Russell King (Oracle)
2025-10-23 18:46   ` Andrew Lunn
2025-10-24 11:10     ` Russell King (Oracle)
2025-10-24 11:54       ` Andrew Lunn
2025-10-23  9:37 ` [PATCH net-next 3/8] net: stmmac: consolidate version reading and validation Russell King (Oracle)
2025-10-23 18:48   ` Andrew Lunn
2025-10-23  9:37 ` [PATCH net-next 4/8] net: stmmac: move stmmac_get_*id() into stmmac_get_version() Russell King (Oracle)
2025-10-23 18:48   ` Andrew Lunn
2025-10-23  9:37 ` [PATCH net-next 5/8] net: stmmac: use FIELD_GET() for version register Russell King (Oracle)
2025-10-23 18:49   ` Andrew Lunn
2025-10-23  9:37 ` [PATCH net-next 6/8] net: stmmac: provide function to lookup hwif Russell King (Oracle)
2025-10-23 18:51   ` Andrew Lunn
2025-10-23  9:37 ` [PATCH net-next 7/8] net: stmmac: use != rather than ^ for comparing dev_id Russell King (Oracle)
2025-10-23 18:51   ` Andrew Lunn
2025-10-23  9:38 ` [PATCH net-next 8/8] net: stmmac: reorganise stmmac_hwif_init() Russell King (Oracle)
2025-10-23 18:52   ` Andrew Lunn
2025-10-24  6:44 ` [PATCH net-next 0/8] net: stmmac: hwif.c cleanups Maxime Chevallier
2025-10-24 10:48   ` Russell King (Oracle)
2025-10-24 10:53     ` Maxime Chevallier

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).