Skip to contentSkip to conversation

mvneta: dont call mvneta_adjust_link() manually

PATCH Applied Stas Sergeev 2 participants 2 messages Apr 1, 2015 – Apr 6, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mvneta: dont call mvneta_adjust_link() manually

mvneta_adjust_link() is a callback for of_phy_connect() and should not be called directly. The result of calling it directly is as below:
---
mvneta f1030000.ethernet eth1: Link is Up - Unsupported (update p
hy.c)/Half - flow control off
---

This is because initially the struct phy_device is created with invalid parameters. phylib calls adjust_link() only when the parameters are validated, but calling it by hands may happen too early.

CC Thomas Petazzoni <[email protected]>
CC Florian Fainelli <[email protected]>
---
 drivers/net/ethernet/marvell/mvneta.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +1 -6
index 0e17fd0..ccb1433 100644
@@ -2729,16 +2729,11 @@ static int mvneta_stop(struct net_device *dev)
 static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
 	struct mvneta_port *pp = netdev_priv(dev);
-	int ret;
 
 	if (!pp->phy_dev)
 		return -ENOTSUPP;
 
-	ret = phy_mii_ioctl(pp->phy_dev, ifr, cmd);
-	if (!ret)
-		mvneta_adjust_link(dev);
-
-	return ret;
+	return phy_mii_ioctl(pp->phy_dev, ifr, cmd);
 }
 
 /* Ethtool methods */
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw

From: Stas Sergeev <[email protected]>
Date: Wed, 01 Apr 2015 19:23:29 +0300

Quoted 12 lines

mvneta_adjust_link() is a callback for of_phy_connect() and should not be called directly. The result of calling it directly is as below:
---
mvneta f1030000.ethernet eth1: Link is Up - Unsupported (update p
hy.c)/Half - flow control off
---

This is because initially the struct phy_device is created with invalid parameters. phylib calls adjust_link() only when the parameters are validated, but calling it by hands may happen too early.

Quoted 6 lines
CC Thomas Petazzoni <[email protected]>
CC Florian Fainelli <[email protected]>

Applied, thanks.