netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/7] net: pcs: xpcs: yet more cleanups
@ 2024-10-17 11:52 Russell King (Oracle)
  2024-10-17 11:52 ` [PATCH net-next 1/7] net: pcs: xpcs: use generic register definitions Russell King (Oracle)
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Russell King (Oracle) @ 2024-10-17 11:52 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Jose Abreu, netdev,
	Paolo Abeni

Hi,

I've found yet more potential for cleanups in the XPCS driver.

The first patch switches to using generic register definitions.

Next, there's an overly complex bit of code in xpcs_link_up_1000basex()
which can be simplified down to a simple if() statement.

Then, rearrange xpcs_link_up_1000basex() to separate out the warnings
from the functional bit.

Next, realising that the functional bit is just the helper function we
already have and are using in the SGMII version of this function,
switch over to that.

We can now see that xpcs_link_up_1000basex() and xpcs_link_up_sgmii()
are basically functionally identical except for the warnings, so merge
the two functions.

Next, xpcs_config_usxgmii() seems misnamed, so rename it to follow the
established pattern.

Lastly, "return foo();" where foo is a void function and the function
being returned from is also void is a weird programming pattern.
Replace this with something more conventional.

With these changes, we see yet another reduction in the amount of
code in this driver.

 drivers/net/pcs/pcs-xpcs.c | 134 ++++++++++++++++++++++-----------------------
 drivers/net/pcs/pcs-xpcs.h |  12 ----
 2 files changed, 65 insertions(+), 81 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] 17+ messages in thread

end of thread, other threads:[~2024-10-28 21:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 11:52 [PATCH net-next 0/7] net: pcs: xpcs: yet more cleanups Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 1/7] net: pcs: xpcs: use generic register definitions Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 2/7] net: pcs: xpcs: remove switch() in xpcs_link_up_1000basex() Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 3/7] net: pcs: xpcs: rearrange xpcs_link_up_1000basex() Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 4/7] net: pcs: xpcs: replace open-coded mii_bmcr_encode_fixed() Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 5/7] net: pcs: xpcs: combine xpcs_link_up_{1000basex,sgmii}() Russell King (Oracle)
2024-10-17 11:53 ` [PATCH net-next 6/7] net: pcs: xpcs: rename xpcs_config_usxgmii() Russell King (Oracle)
2024-10-17 11:53 ` [PATCH net-next 7/7] net: pcs: xpcs: remove return statements in void function Russell King (Oracle)
2024-10-21 11:08 ` [PATCH net-next 0/7] net: pcs: xpcs: yet more cleanups Serge Semin
2024-10-22 21:42   ` Serge Semin
2024-10-22  8:59 ` Russell King (Oracle)
2024-10-22  9:23   ` Paolo Abeni
2024-10-22  9:30     ` Russell King (Oracle)
2024-10-23 11:17 ` Russell King (Oracle)
2024-10-23 11:58   ` Paolo Abeni
2024-10-28 21:07   ` Jakub Kicinski
2024-10-23 14:40 ` patchwork-bot+netdevbpf

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