]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: pcs: xpcs: replace open-coded mii_bmcr_encode_fixed()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 17 Oct 2024 11:52:54 +0000 (12:52 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Wed, 23 Oct 2024 14:10:16 +0000 (16:10 +0200)
We can now see that we have an open-coded version of
mii_bmcr_encode_fixed() when this is called with SPEED_1000:

        val = BMCR_SPEED1000;
        if (duplex == DUPLEX_FULL)
                val |= BMCR_FULLDPLX;

Replace this with a call to mii_bmcr_encode_fixed().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/pcs/pcs-xpcs.c

index 3222b8851bff44eda524c7965391b74743d94cde..5b38f9019f83e0654c58391f9a26cf0cbbaf92a8 100644 (file)
@@ -1137,10 +1137,7 @@ static void xpcs_link_up_1000basex(struct dw_xpcs *xpcs, unsigned int neg_mode,
                dev_err(&xpcs->mdiodev->dev, "%s: half duplex not supported\n",
                        __func__);
 
-       val = BMCR_SPEED1000;
-       if (duplex == DUPLEX_FULL)
-               val |= BMCR_FULLDPLX;
-
+       val = mii_bmcr_encode_fixed(speed, duplex);
        ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, val);
        if (ret)
                dev_err(&xpcs->mdiodev->dev, "%s: xpcs_write returned %pe\n",