Skip to contentSkip to conversation

net: dsa: Remove redundant phy_attach()

PATCH Applied Andrew Lunn 3 participants 3 messages Feb 9, 2015

Subsystems (3)
lore
Share & tools
lore

Andrew Lunn

author maintainer
#0 lore raw

PATCH 1/1 net: dsa: Remove redundant phy_attach()

dsa_slave_phy_setup() finds the phy for the port via device tree and using of_phy_connect(), or it uses the fall back of taking a phy from the switch internal mdio bus and calling phy_connect_direct(). Either way, if a phy is found, phy_attach_direct() is called to attach the phy to the slave device.

In dsa_slave_create(), a second call to phy_attach() is made. This results in the warning "PHY already attached". Remove this second, redundant attaching of the phy.

---
 net/dsa/slave.c | 13 -------------
 1 file changed, 13 deletions(-)
net/dsa/slave.c +0 -13
index 589aafd01fc5..d104ae15836f 100644
@@ -676,18 +676,5 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 
 	netif_carrier_off(slave_dev);
 
-	if (p->phy != NULL) {
-		if (ds->drv->get_phy_flags)
-			p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
-
-		phy_attach(slave_dev, dev_name(&p->phy->dev),
-			   PHY_INTERFACE_MODE_GMII);
-
-		p->phy->autoneg = AUTONEG_ENABLE;
-		p->phy->speed = 0;
-		p->phy->duplex = 0;
-		p->phy->advertising = p->phy->supported | ADVERTISED_Autoneg;
-	}
-
 	return slave_dev;
 }
Signature · 1 line
2.1.4
Acked-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Andrew Lunn

dsa_slave_phy_setup() finds the phy for the port via device tree and using of_phy_connect(), or it uses the fall back of taking a phy from the switch internal mdio bus and calling phy_connect_direct(). Either way, if a phy is found, phy_attach_direct() is called to attach the phy to the slave device.

In dsa_slave_create(), a second call to phy_attach() is made. This results in the warning "PHY already attached". Remove this second, redundant attaching of the phy.

Quoted 28 lines
---
 net/dsa/slave.c | 13 -------------
 1 file changed, 13 deletions(-)
net/dsa/slave.c +0 -13
index 589aafd01fc5..d104ae15836f 100644
@@ -676,18 +676,5 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 
 	netif_carrier_off(slave_dev);
 
-	if (p->phy != NULL) {
-		if (ds->drv->get_phy_flags)
-			p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
-
-		phy_attach(slave_dev, dev_name(&p->phy->dev),
-			   PHY_INTERFACE_MODE_GMII);
-
-		p->phy->autoneg = AUTONEG_ENABLE;
-		p->phy->speed = 0;
-		p->phy->duplex = 0;
-		p->phy->advertising = p->phy->supported | ADVERTISED_Autoneg;
-	}
-
 	return slave_dev;
 }
Signature · 1 line
Florian
Applied
#2 lore raw

From: Florian Fainelli <[email protected]>
Date: Mon, 09 Feb 2015 11:21:26 -0800

Quoted 7 lines · Andrew Lunn
Quoted 6 lines

dsa_slave_phy_setup() finds the phy for the port via device tree and using of_phy_connect(), or it uses the fall back of taking a phy from the switch internal mdio bus and calling phy_connect_direct(). Either way, if a phy is found, phy_attach_direct() is called to attach the phy to the slave device.

Quoted 8 lines
Quoted 5 lines

In dsa_slave_create(), a second call to phy_attach() is made. This results in the warning "PHY already attached". Remove this second, redundant attaching of the phy.

Applied, thanks.