diff mbox series

[net-next,11/11] net: phy: marvell: use genphy_check_and_restart_aneg()

Message ID E1ihD4q-0001zY-8c@rmk-PC.armlinux.org.uk
State Accepted
Delegated to: David Miller
Headers show
Series phylib consolidation | expand

Commit Message

Russell King (Oracle) Dec. 17, 2019, 1:39 p.m. UTC
Use the helper to check and restart autonegotiation for the marvell
fiber page negotiation setting.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/marvell.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

Comments

Andrew Lunn Dec. 17, 2019, 3:48 p.m. UTC | #1
On Tue, Dec 17, 2019 at 01:39:52PM +0000, Russell King wrote:
> Use the helper to check and restart autonegotiation for the marvell
> fiber page negotiation setting.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Florian Fainelli Dec. 17, 2019, 5:36 p.m. UTC | #2
On 12/17/19 5:39 AM, Russell King wrote:
> Use the helper to check and restart autonegotiation for the marvell
> fiber page negotiation setting.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index c40d49523719..a173c05fdb4c 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -545,26 +545,7 @@  static int marvell_config_aneg_fiber(struct phy_device *phydev)
 	if (err > 0)
 		changed = 1;
 
-	if (changed == 0) {
-		/* Advertisement hasn't changed, but maybe aneg was never on to
-		 * begin with?	Or maybe phy was isolated?
-		 */
-		int ctl = phy_read(phydev, MII_BMCR);
-
-		if (ctl < 0)
-			return ctl;
-
-		if (!(ctl & BMCR_ANENABLE) || (ctl & BMCR_ISOLATE))
-			changed = 1; /* do restart aneg */
-	}
-
-	/* Only restart aneg if we are advertising something different
-	 * than we were before.
-	 */
-	if (changed > 0)
-		changed = genphy_restart_aneg(phydev);
-
-	return changed;
+	return genphy_check_and_restart_aneg(phydev, changed);
 }
 
 static int m88e1510_config_aneg(struct phy_device *phydev)