Skip to content

net: pcs: xpcs: yet more cleanups

Russell King (Oracle) netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 7 patches 8 repliesApplied

Patches in v1 Applied

None of the 7 patches the cover letter announces are in this archive.

Reviews trailers per patch

PatchSerge Semin
SeriesT-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 0/7] net: pcs: xpcs: yet more cleanups

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(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!