net: phy: use phy_resolve_aneg_pause()
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 17 Dec 2019 13:39:06 +0000 (13:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Dec 2019 20:52:34 +0000 (12:52 -0800)
Several drivers code their own version of this, working from the LPA
register, after setting the ethtool link partner advertisement bitmask.
Use the generic function instead.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/lxt.c
drivers/net/phy/marvell.c
drivers/net/phy/uPD60620.c

index 356bd6472f494c82a7bda2a924d2a4568b2ff554..30172852e36e62ab5790646698d45587f8f7fda5 100644 (file)
@@ -190,10 +190,7 @@ static int lxt973a2_read_status(struct phy_device *phydev)
                                phydev->duplex = DUPLEX_FULL;
                }
 
-               if (phydev->duplex == DUPLEX_FULL) {
-                       phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
-                       phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
-               }
+               phy_resolve_aneg_pause(phydev);
        } else {
                int bmcr = phy_read(phydev, MII_BMCR);
 
index b1fbd193732893952af194e4f470b1430de86521..d807c3e5cc566eff2cd8d44a4615b4ccff0fdc66 100644 (file)
@@ -1384,10 +1384,7 @@ static int marvell_read_status_page_an(struct phy_device *phydev,
                mii_lpa_to_linkmode_lpa_t(phydev->lp_advertising, lpa);
                mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, lpagb);
 
-               if (phydev->duplex == DUPLEX_FULL) {
-                       phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
-                       phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
-               }
+               phy_resolve_aneg_pause(phydev);
        } else {
                /* The fiber link is only 1000M capable */
                fiber_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa);
index a32b3fd8a3705c1fb7e9c8d894631f560dc1196c..38834347a427eb651eeeee05346b0bd5120fce40 100644 (file)
@@ -68,12 +68,7 @@ static int upd60620_read_status(struct phy_device *phydev)
                        mii_lpa_to_linkmode_lpa_t(phydev->lp_advertising,
                                                  phy_state);
 
-                       if (phydev->duplex == DUPLEX_FULL) {
-                               if (phy_state & LPA_PAUSE_CAP)
-                                       phydev->pause = 1;
-                               if (phy_state & LPA_PAUSE_ASYM)
-                                       phydev->asym_pause = 1;
-                       }
+                       phy_resolve_aneg_pause(phydev);
                }
        }
        return 0;