aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2013-01-13 19:52:52 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-14 15:11:50 -0500
commitf9a8f83b04e0c362a2fc660dbad980d24af209fc (patch)
tree055b2c8f2d32f3cfd0dc84fd3f8d971a34aeed85
parentc1b52739e45f5969b208ebc377f52468280af11e (diff)
net: phy: remove flags argument from phy_{attach, connect, connect_direct}
The flags argument of the phy_{attach,connect,connect_direct} functions is then used to assign a struct phy_device dev_flags with its value. All callers but the tg3 driver pass the flag 0, which results in the underlying PHY drivers in drivers/net/phy/ not being able to actually use any of the flags they would set in dev_flags. This patch gets rid of the flags argument, and passes phydev->dev_flags to the internal PHY library call phy_attach_direct() such that drivers which actually modify a phy device dev_flags get the value preserved for use by the underlying phy driver. Acked-by: Kosta Zertsekel <konszert@marvell.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/networking/phy.txt11
-rw-r--r--drivers/net/ethernet/8390/ax88796.c2
-rw-r--r--drivers/net/ethernet/adi/bfin_mac.c4
-rw-r--r--drivers/net/ethernet/aeroflex/greth.c4
-rw-r--r--drivers/net/ethernet/amd/au1000_eth.c4
-rw-r--r--drivers/net/ethernet/broadcom/bcm63xx_enet.c2
-rw-r--r--drivers/net/ethernet/broadcom/sb1250-mac.c2
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c4
-rw-r--r--drivers/net/ethernet/cadence/macb.c2
-rw-r--r--drivers/net/ethernet/dnet.c4
-rw-r--r--drivers/net/ethernet/ethoc.c4
-rw-r--r--drivers/net/ethernet/faraday/ftgmac100.c3
-rw-r--r--drivers/net/ethernet/freescale/fec.c2
-rw-r--r--drivers/net/ethernet/lantiq_etop.c4
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c2
-rw-r--r--drivers/net/ethernet/marvell/pxa168_eth.c2
-rw-r--r--drivers/net/ethernet/nxp/lpc_eth.c2
-rw-r--r--drivers/net/ethernet/rdc/r6040.c2
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c2
-rw-r--r--drivers/net/ethernet/s6gmac.c2
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c5
-rw-r--r--drivers/net/ethernet/smsc/smsc9420.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c3
-rw-r--r--drivers/net/ethernet/ti/cpmac.c4
-rw-r--r--drivers/net/ethernet/ti/cpsw.c2
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c2
-rw-r--r--drivers/net/ethernet/toshiba/tc35815.c5
-rw-r--r--drivers/net/ethernet/xscale/ixp4xx_eth.c2
-rw-r--r--drivers/net/phy/phy_device.c15
-rw-r--r--drivers/net/usb/ax88172a.c2
-rw-r--r--drivers/of/of_mdio.c4
-rw-r--r--drivers/staging/et131x/et131x.c2
-rw-r--r--include/linux/phy.h6
-rw-r--r--net/dsa/slave.c2
34 files changed, 56 insertions, 64 deletions
diff --git a/Documentation/networking/phy.txt b/Documentation/networking/phy.txt
index 95e5f5985a2a..d5b1a3935245 100644
--- a/Documentation/networking/phy.txt
+++ b/Documentation/networking/phy.txt
@@ -103,7 +103,7 @@ Letting the PHY Abstraction Layer do Everything
103 103
104 Now, to connect, just call this function: 104 Now, to connect, just call this function:
105 105
106 phydev = phy_connect(dev, phy_name, &adjust_link, flags, interface); 106 phydev = phy_connect(dev, phy_name, &adjust_link, interface);
107 107
108 phydev is a pointer to the phy_device structure which represents the PHY. If 108 phydev is a pointer to the phy_device structure which represents the PHY. If
109 phy_connect is successful, it will return the pointer. dev, here, is the 109 phy_connect is successful, it will return the pointer. dev, here, is the
@@ -113,7 +113,9 @@ Letting the PHY Abstraction Layer do Everything
113 current state, though the PHY will not yet be truly operational at this 113 current state, though the PHY will not yet be truly operational at this
114 point. 114 point.
115 115
116 flags is a u32 which can optionally contain phy-specific flags. 116 PHY-specific flags should be set in phydev->dev_flags prior to the call
117 to phy_connect() such that the underlying PHY driver can check for flags
118 and perform specific operations based on them.
117 This is useful if the system has put hardware restrictions on 119 This is useful if the system has put hardware restrictions on
118 the PHY/controller, of which the PHY needs to be aware. 120 the PHY/controller, of which the PHY needs to be aware.
119 121
@@ -185,11 +187,10 @@ Doing it all yourself
185 start, or disables then frees them for stop. 187 start, or disables then frees them for stop.
186 188
187 struct phy_device * phy_attach(struct net_device *dev, const char *phy_id, 189 struct phy_device * phy_attach(struct net_device *dev, const char *phy_id,
188 u32 flags, phy_interface_t interface); 190 phy_interface_t interface);
189 191
190 Attaches a network device to a particular PHY, binding the PHY to a generic 192 Attaches a network device to a particular PHY, binding the PHY to a generic
191 driver if none was found during bus initialization. Passes in 193 driver if none was found during bus initialization.
192 any phy-specific flags as needed.
193 194
194 int phy_start_aneg(struct phy_device *phydev); 195 int phy_start_aneg(struct phy_device *phydev);
195 196
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index 7eeddf01307f..cab306a9888e 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -358,7 +358,7 @@ static int ax_mii_probe(struct net_device *dev)
358 return -ENODEV; 358 return -ENODEV;
359 } 359 }
360 360
361 ret = phy_connect_direct(dev, phy_dev, ax_handle_link_change, 0, 361 ret = phy_connect_direct(dev, phy_dev, ax_handle_link_change,
362 PHY_INTERFACE_MODE_MII); 362 PHY_INTERFACE_MODE_MII);
363 if (ret) { 363 if (ret) {
364 netdev_err(dev, "Could not attach to PHY\n"); 364 netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
index c7a83f6f2382..a175d0be1ae1 100644
--- a/drivers/net/ethernet/adi/bfin_mac.c
+++ b/drivers/net/ethernet/adi/bfin_mac.c
@@ -425,8 +425,8 @@ static int mii_probe(struct net_device *dev, int phy_mode)
425 return -EINVAL; 425 return -EINVAL;
426 } 426 }
427 427
428 phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link, 428 phydev = phy_connect(dev, dev_name(&phydev->dev),
429 0, phy_mode); 429 &bfin_mac_adjust_link, phy_mode);
430 430
431 if (IS_ERR(phydev)) { 431 if (IS_ERR(phydev)) {
432 netdev_err(dev, "could not attach PHY\n"); 432 netdev_err(dev, "could not attach PHY\n");
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index 480662ba5227..0be2195e5034 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1288,9 +1288,7 @@ static int greth_mdio_probe(struct net_device *dev)
1288 } 1288 }
1289 1289
1290 ret = phy_connect_direct(dev, phy, &greth_link_change, 1290 ret = phy_connect_direct(dev, phy, &greth_link_change,
1291 0, greth->gbit_mac ? 1291 greth->gbit_mac ? PHY_INTERFACE_MODE_GMII : PHY_INTERFACE_MODE_MII);
1292 PHY_INTERFACE_MODE_GMII :
1293 PHY_INTERFACE_MODE_MII);
1294 if (ret) { 1292 if (ret) {
1295 if (netif_msg_ifup(greth)) 1293 if (netif_msg_ifup(greth))
1296 dev_err(&dev->dev, "could not attach to PHY\n"); 1294 dev_err(&dev->dev, "could not attach to PHY\n");
diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index 65b865a0cc78..de774d419144 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -437,8 +437,8 @@ static int au1000_mii_probe(struct net_device *dev)
437 /* now we are supposed to have a proper phydev, to attach to... */ 437 /* now we are supposed to have a proper phydev, to attach to... */
438 BUG_ON(phydev->attached_dev); 438 BUG_ON(phydev->attached_dev);
439 439
440 phydev = phy_connect(dev, dev_name(&phydev->dev), &au1000_adjust_link, 440 phydev = phy_connect(dev, dev_name(&phydev->dev),
441 0, PHY_INTERFACE_MODE_MII); 441 &au1000_adjust_link, PHY_INTERFACE_MODE_MII);
442 442
443 if (IS_ERR(phydev)) { 443 if (IS_ERR(phydev)) {
444 netdev_err(dev, "Could not attach to PHY\n"); 444 netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index d8a151046728..f5b6b4715d45 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -799,7 +799,7 @@ static int bcm_enet_open(struct net_device *dev)
799 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, 799 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
800 priv->mii_bus->id, priv->phy_id); 800 priv->mii_bus->id, priv->phy_id);
801 801
802 phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0, 802 phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link,
803 PHY_INTERFACE_MODE_MII); 803 PHY_INTERFACE_MODE_MII);
804 804
805 if (IS_ERR(phydev)) { 805 if (IS_ERR(phydev)) {
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index 3a1c8a3cf7c9..e9b35da375cb 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -2385,7 +2385,7 @@ static int sbmac_mii_probe(struct net_device *dev)
2385 return -ENXIO; 2385 return -ENXIO;
2386 } 2386 }
2387 2387
2388 phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), &sbmac_mii_poll, 0, 2388 phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), &sbmac_mii_poll,
2389 PHY_INTERFACE_MODE_GMII); 2389 PHY_INTERFACE_MODE_GMII);
2390 if (IS_ERR(phy_dev)) { 2390 if (IS_ERR(phy_dev)) {
2391 printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); 2391 printk(KERN_ERR "%s: could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 88f2d41c009b..227749107789 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -2004,8 +2004,8 @@ static int tg3_phy_init(struct tg3 *tp)
2004 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 2004 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
2005 2005
2006 /* Attach the MAC to the PHY. */ 2006 /* Attach the MAC to the PHY. */
2007 phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link, 2007 phydev = phy_connect(tp->dev, dev_name(&phydev->dev),
2008 phydev->dev_flags, phydev->interface); 2008 tg3_adjust_link, phydev->interface);
2009 if (IS_ERR(phydev)) { 2009 if (IS_ERR(phydev)) {
2010 dev_err(&tp->pdev->dev, "Could not attach to PHY\n"); 2010 dev_err(&tp->pdev->dev, "Could not attach to PHY\n");
2011 return PTR_ERR(phydev); 2011 return PTR_ERR(phydev);
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index a9b0830fb39d..352190b9ebe7 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -287,7 +287,7 @@ static int macb_mii_probe(struct net_device *dev)
287 } 287 }
288 288
289 /* attach the mac to the phy */ 289 /* attach the mac to the phy */
290 ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0, 290 ret = phy_connect_direct(dev, phydev, &macb_handle_link_change,
291 bp->phy_interface); 291 bp->phy_interface);
292 if (ret) { 292 if (ret) {
293 netdev_err(dev, "Could not attach to PHY\n"); 293 netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c
index 2c177b329c8b..f3d60eb13c3a 100644
--- a/drivers/net/ethernet/dnet.c
+++ b/drivers/net/ethernet/dnet.c
@@ -281,11 +281,11 @@ static int dnet_mii_probe(struct net_device *dev)
281 /* attach the mac to the phy */ 281 /* attach the mac to the phy */
282 if (bp->capabilities & DNET_HAS_RMII) { 282 if (bp->capabilities & DNET_HAS_RMII) {
283 phydev = phy_connect(dev, dev_name(&phydev->dev), 283 phydev = phy_connect(dev, dev_name(&phydev->dev),
284 &dnet_handle_link_change, 0, 284 &dnet_handle_link_change,
285 PHY_INTERFACE_MODE_RMII); 285 PHY_INTERFACE_MODE_RMII);
286 } else { 286 } else {
287 phydev = phy_connect(dev, dev_name(&phydev->dev), 287 phydev = phy_connect(dev, dev_name(&phydev->dev),
288 &dnet_handle_link_change, 0, 288 &dnet_handle_link_change,
289 PHY_INTERFACE_MODE_MII); 289 PHY_INTERFACE_MODE_MII);
290 } 290 }
291 291
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index b51c81ac0b6f..aa47ef9689a8 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -682,8 +682,8 @@ static int ethoc_mdio_probe(struct net_device *dev)
682 return -ENXIO; 682 return -ENXIO;
683 } 683 }
684 684
685 err = phy_connect_direct(dev, phy, ethoc_mdio_poll, 0, 685 err = phy_connect_direct(dev, phy, ethoc_mdio_poll,
686 PHY_INTERFACE_MODE_GMII); 686 PHY_INTERFACE_MODE_GMII);
687 if (err) { 687 if (err) {
688 dev_err(&dev->dev, "could not attach to PHY\n"); 688 dev_err(&dev->dev, "could not attach to PHY\n");
689 return err; 689 return err;
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 96454b5fca63..7c361d1db94c 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -858,8 +858,7 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv)
858 } 858 }
859 859
860 phydev = phy_connect(netdev, dev_name(&phydev->dev), 860 phydev = phy_connect(netdev, dev_name(&phydev->dev),
861 &ftgmac100_adjust_link, 0, 861 &ftgmac100_adjust_link, PHY_INTERFACE_MODE_GMII);
862 PHY_INTERFACE_MODE_GMII);
863 862
864 if (IS_ERR(phydev)) { 863 if (IS_ERR(phydev)) {
865 netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name); 864 netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name);
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 5f2b4acf4836..1b7684a8851e 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1008,7 +1008,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
1008 } 1008 }
1009 1009
1010 snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id); 1010 snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id);
1011 phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0, 1011 phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link,
1012 fep->phy_interface); 1012 fep->phy_interface);
1013 if (IS_ERR(phy_dev)) { 1013 if (IS_ERR(phy_dev)) {
1014 printk(KERN_ERR "%s: could not attach to PHY\n", ndev->name); 1014 printk(KERN_ERR "%s: could not attach to PHY\n", ndev->name);
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 8ead46adc21e..6a2127489af7 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -393,8 +393,8 @@ ltq_etop_mdio_probe(struct net_device *dev)
393 return -ENODEV; 393 return -ENODEV;
394 } 394 }
395 395
396 phydev = phy_connect(dev, dev_name(&phydev->dev), &ltq_etop_mdio_link, 396 phydev = phy_connect(dev, dev_name(&phydev->dev),
397 0, priv->pldata->mii_mode); 397 &ltq_etop_mdio_link, priv->pldata->mii_mode);
398 398
399 if (IS_ERR(phydev)) { 399 if (IS_ERR(phydev)) {
400 netdev_err(dev, "Could not attach to PHY\n"); 400 netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 84c13263c514..c27b23d8f4fc 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2789,7 +2789,7 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex)
2789 2789
2790 phy_reset(mp); 2790 phy_reset(mp);
2791 2791
2792 phy_attach(mp->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_GMII); 2792 phy_attach(mp->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_GMII);
2793 2793
2794 if (speed == 0) { 2794 if (speed == 0) {
2795 phy->autoneg = AUTONEG_ENABLE; 2795 phy->autoneg = AUTONEG_ENABLE;
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index c7f2fa60fe6f..037ed866c22f 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1390,7 +1390,7 @@ static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex)
1390 struct phy_device *phy = pep->phy; 1390 struct phy_device *phy = pep->phy;
1391 ethernet_phy_reset(pep); 1391 ethernet_phy_reset(pep);
1392 1392
1393 phy_attach(pep->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_MII); 1393 phy_attach(pep->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_MII);
1394 1394
1395 if (speed == 0) { 1395 if (speed == 0) {
1396 phy->autoneg = AUTONEG_ENABLE; 1396 phy->autoneg = AUTONEG_ENABLE;
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 6fda51ebcc76..c4122c86f829 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -800,7 +800,7 @@ static int lpc_mii_probe(struct net_device *ndev)
800 else 800 else
801 netdev_info(ndev, "using RMII interface\n"); 801 netdev_info(ndev, "using RMII interface\n");
802 phydev = phy_connect(ndev, dev_name(&phydev->dev), 802 phydev = phy_connect(ndev, dev_name(&phydev->dev),
803 &lpc_handle_link_change, 0, 803 &lpc_handle_link_change,
804 lpc_phy_interface_mode(&pldat->pdev->dev)); 804 lpc_phy_interface_mode(&pldat->pdev->dev));
805 805
806 if (IS_ERR(phydev)) { 806 if (IS_ERR(phydev)) {
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index be3616d060d9..34f76e99dc8a 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -1042,7 +1042,7 @@ static int r6040_mii_probe(struct net_device *dev)
1042 } 1042 }
1043 1043
1044 phydev = phy_connect(dev, dev_name(&phydev->dev), &r6040_adjust_link, 1044 phydev = phy_connect(dev, dev_name(&phydev->dev), &r6040_adjust_link,
1045 0, PHY_INTERFACE_MODE_MII); 1045 PHY_INTERFACE_MODE_MII);
1046 1046
1047 if (IS_ERR(phydev)) { 1047 if (IS_ERR(phydev)) {
1048 dev_err(&lp->pdev->dev, "could not attach to PHY\n"); 1048 dev_err(&lp->pdev->dev, "could not attach to PHY\n");
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 3d705862bd7d..e195c1e89d61 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1422,7 +1422,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
1422 1422
1423 /* Try connect to PHY */ 1423 /* Try connect to PHY */
1424 phydev = phy_connect(ndev, phy_id, sh_eth_adjust_link, 1424 phydev = phy_connect(ndev, phy_id, sh_eth_adjust_link,
1425 0, mdp->phy_interface); 1425 mdp->phy_interface);
1426 if (IS_ERR(phydev)) { 1426 if (IS_ERR(phydev)) {
1427 dev_err(&ndev->dev, "phy_connect failed\n"); 1427 dev_err(&ndev->dev, "phy_connect failed\n");
1428 return PTR_ERR(phydev); 1428 return PTR_ERR(phydev);
diff --git a/drivers/net/ethernet/s6gmac.c b/drivers/net/ethernet/s6gmac.c
index 72fc57dd084d..21683e2b1ff4 100644
--- a/drivers/net/ethernet/s6gmac.c
+++ b/drivers/net/ethernet/s6gmac.c
@@ -795,7 +795,7 @@ static inline int s6gmac_phy_start(struct net_device *dev)
795 struct phy_device *p = NULL; 795 struct phy_device *p = NULL;
796 while ((i < PHY_MAX_ADDR) && (!(p = pd->mii.bus->phy_map[i]))) 796 while ((i < PHY_MAX_ADDR) && (!(p = pd->mii.bus->phy_map[i])))
797 i++; 797 i++;
798 p = phy_connect(dev, dev_name(&p->dev), &s6gmac_adjust_link, 0, 798 p = phy_connect(dev, dev_name(&p->dev), &s6gmac_adjust_link,
799 PHY_INTERFACE_MODE_RGMII); 799 PHY_INTERFACE_MODE_RGMII);
800 if (IS_ERR(p)) { 800 if (IS_ERR(p)) {
801 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 801 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 04ff63cb6544..da5cc9a3b34c 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -997,9 +997,8 @@ static int smsc911x_mii_probe(struct net_device *dev)
997 SMSC_TRACE(pdata, probe, "PHY: addr %d, phy_id 0x%08X", 997 SMSC_TRACE(pdata, probe, "PHY: addr %d, phy_id 0x%08X",
998 phydev->addr, phydev->phy_id); 998 phydev->addr, phydev->phy_id);
999 999
1000 ret = phy_connect_direct(dev, phydev, 1000 ret = phy_connect_direct(dev, phydev, &smsc911x_phy_adjust_link,
1001 &smsc911x_phy_adjust_link, 0, 1001 pdata->config.phy_interface);
1002 pdata->config.phy_interface);
1003 1002
1004 if (ret) { 1003 if (ret) {
1005 netdev_err(dev, "Could not attach to PHY\n"); 1004 netdev_err(dev, "Could not attach to PHY\n");
diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index 3c586585e1b3..ecfb43614d7b 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -1179,7 +1179,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
1179 phydev->phy_id); 1179 phydev->phy_id);
1180 1180
1181 phydev = phy_connect(dev, dev_name(&phydev->dev), 1181 phydev = phy_connect(dev, dev_name(&phydev->dev),
1182 smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII); 1182 smsc9420_phy_adjust_link, PHY_INTERFACE_MODE_MII);
1183 1183
1184 if (IS_ERR(phydev)) { 1184 if (IS_ERR(phydev)) {
1185 pr_err("%s: Could not attach to PHY\n", dev->name); 1185 pr_err("%s: Could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f07c0612abf6..8c657294ce56 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -428,8 +428,7 @@ static int stmmac_init_phy(struct net_device *dev)
428 priv->plat->phy_addr); 428 priv->plat->phy_addr);
429 pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id_fmt); 429 pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id_fmt);
430 430
431 phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link, 0, 431 phydev = phy_connect(dev, phy_id_fmt, &stmmac_adjust_link, interface);
432 interface);
433 432
434 if (IS_ERR(phydev)) { 433 if (IS_ERR(phydev)) {
435 pr_err("%s: Could not attach to PHY\n", dev->name); 434 pr_err("%s: Could not attach to PHY\n", dev->name);
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 70d1920cac97..31bbbca341a7 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1172,8 +1172,8 @@ static int cpmac_probe(struct platform_device *pdev)
1172 snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, 1172 snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT,
1173 mdio_bus_id, phy_id); 1173 mdio_bus_id, phy_id);
1174 1174
1175 priv->phy = phy_connect(dev, priv->phy_name, cpmac_adjust_link, 0, 1175 priv->phy = phy_connect(dev, priv->phy_name, cpmac_adjust_link,
1176 PHY_INTERFACE_MODE_MII); 1176 PHY_INTERFACE_MODE_MII);
1177 1177
1178 if (IS_ERR(priv->phy)) { 1178 if (IS_ERR(priv->phy)) {
1179 if (netif_msg_drv(priv)) 1179 if (netif_msg_drv(priv))
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index bea736b8c3ec..3772804fb697 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -592,7 +592,7 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
592 1 << slave_port, 0, ALE_MCAST_FWD_2); 592 1 << slave_port, 0, ALE_MCAST_FWD_2);
593 593
594 slave->phy = phy_connect(priv->ndev, slave->data->phy_id, 594 slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
595 &cpsw_adjust_link, 0, slave->data->phy_if); 595 &cpsw_adjust_link, slave->data->phy_if);
596 if (IS_ERR(slave->phy)) { 596 if (IS_ERR(slave->phy)) {
597 dev_err(priv->dev, "phy %s not found on slave %d\n", 597 dev_err(priv->dev, "phy %s not found on slave %d\n",
598 slave->data->phy_id, slave->slave_num); 598 slave->data->phy_id, slave->slave_num);
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 6621ae3a98d9..8478d98c1092 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1599,7 +1599,7 @@ static int emac_dev_open(struct net_device *ndev)
1599 1599
1600 if (priv->phy_id && *priv->phy_id) { 1600 if (priv->phy_id && *priv->phy_id) {
1601 priv->phydev = phy_connect(ndev, priv->phy_id, 1601 priv->phydev = phy_connect(ndev, priv->phy_id,
1602 &emac_adjust_link, 0, 1602 &emac_adjust_link,
1603 PHY_INTERFACE_MODE_MII); 1603 PHY_INTERFACE_MODE_MII);
1604 1604
1605 if (IS_ERR(priv->phydev)) { 1605 if (IS_ERR(priv->phydev)) {
diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
index f16410e599f4..fe256094db35 100644
--- a/drivers/net/ethernet/toshiba/tc35815.c
+++ b/drivers/net/ethernet/toshiba/tc35815.c
@@ -633,9 +633,8 @@ static int tc_mii_probe(struct net_device *dev)
633 633
634 /* attach the mac to the phy */ 634 /* attach the mac to the phy */
635 phydev = phy_connect(dev, dev_name(&phydev->dev), 635 phydev = phy_connect(dev, dev_name(&phydev->dev),
636 &tc_handle_link_change, 0, 636 &tc_handle_link_change,
637 lp->chiptype == TC35815_TX4939 ? 637 lp->chiptype == TC35815_TX4939 ? PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII);
638 PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII);
639 if (IS_ERR(phydev)) { 638 if (IS_ERR(phydev)) {
640 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 639 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
641 return PTR_ERR(phydev); 640 return PTR_ERR(phydev);
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index a4be1ad886c5..6958a5e87703 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1451,7 +1451,7 @@ static int eth_init_one(struct platform_device *pdev)
1451 1451
1452 snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, 1452 snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
1453 mdio_bus->id, plat->phy); 1453 mdio_bus->id, plat->phy);
1454 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, 1454 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link,
1455 PHY_INTERFACE_MODE_MII); 1455 PHY_INTERFACE_MODE_MII);
1456 if (IS_ERR(port->phydev)) { 1456 if (IS_ERR(port->phydev)) {
1457 err = PTR_ERR(port->phydev); 1457 err = PTR_ERR(port->phydev);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 8af46e88a181..9930f9999561 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -416,16 +416,15 @@ static void phy_prepare_link(struct phy_device *phydev,
416 * @dev: the network device to connect 416 * @dev: the network device to connect
417 * @phydev: the pointer to the phy device 417 * @phydev: the pointer to the phy device
418 * @handler: callback function for state change notifications 418 * @handler: callback function for state change notifications
419 * @flags: PHY device's dev_flags
420 * @interface: PHY device's interface 419 * @interface: PHY device's interface
421 */ 420 */
422int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, 421int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
423 void (*handler)(struct net_device *), u32 flags, 422 void (*handler)(struct net_device *),
424 phy_interface_t interface) 423 phy_interface_t interface)
425{ 424{
426 int rc; 425 int rc;
427 426
428 rc = phy_attach_direct(dev, phydev, flags, interface); 427 rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface);
429 if (rc) 428 if (rc)
430 return rc; 429 return rc;
431 430
@@ -443,7 +442,6 @@ EXPORT_SYMBOL(phy_connect_direct);
443 * @dev: the network device to connect 442 * @dev: the network device to connect
444 * @bus_id: the id string of the PHY device to connect 443 * @bus_id: the id string of the PHY device to connect
445 * @handler: callback function for state change notifications 444 * @handler: callback function for state change notifications
446 * @flags: PHY device's dev_flags
447 * @interface: PHY device's interface 445 * @interface: PHY device's interface
448 * 446 *
449 * Description: Convenience function for connecting ethernet 447 * Description: Convenience function for connecting ethernet
@@ -455,7 +453,7 @@ EXPORT_SYMBOL(phy_connect_direct);
455 * the desired functionality. 453 * the desired functionality.
456 */ 454 */
457struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 455struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
458 void (*handler)(struct net_device *), u32 flags, 456 void (*handler)(struct net_device *),
459 phy_interface_t interface) 457 phy_interface_t interface)
460{ 458{
461 struct phy_device *phydev; 459 struct phy_device *phydev;
@@ -471,7 +469,7 @@ struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
471 } 469 }
472 phydev = to_phy_device(d); 470 phydev = to_phy_device(d);
473 471
474 rc = phy_connect_direct(dev, phydev, handler, flags, interface); 472 rc = phy_connect_direct(dev, phydev, handler, interface);
475 if (rc) 473 if (rc)
476 return ERR_PTR(rc); 474 return ERR_PTR(rc);
477 475
@@ -576,14 +574,13 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
576 * phy_attach - attach a network device to a particular PHY device 574 * phy_attach - attach a network device to a particular PHY device
577 * @dev: network device to attach 575 * @dev: network device to attach
578 * @bus_id: Bus ID of PHY device to attach 576 * @bus_id: Bus ID of PHY device to attach
579 * @flags: PHY device's dev_flags
580 * @interface: PHY device's interface 577 * @interface: PHY device's interface
581 * 578 *
582 * Description: Same as phy_attach_direct() except that a PHY bus_id 579 * Description: Same as phy_attach_direct() except that a PHY bus_id
583 * string is passed instead of a pointer to a struct phy_device. 580 * string is passed instead of a pointer to a struct phy_device.
584 */ 581 */
585struct phy_device *phy_attach(struct net_device *dev, 582struct phy_device *phy_attach(struct net_device *dev,
586 const char *bus_id, u32 flags, phy_interface_t interface) 583 const char *bus_id, phy_interface_t interface)
587{ 584{
588 struct bus_type *bus = &mdio_bus_type; 585 struct bus_type *bus = &mdio_bus_type;
589 struct phy_device *phydev; 586 struct phy_device *phydev;
@@ -599,7 +596,7 @@ struct phy_device *phy_attach(struct net_device *dev,
599 } 596 }
600 phydev = to_phy_device(d); 597 phydev = to_phy_device(d);
601 598
602 rc = phy_attach_direct(dev, phydev, flags, interface); 599 rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface);
603 if (rc) 600 if (rc)
604 return ERR_PTR(rc); 601 return ERR_PTR(rc);
605 602
diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c
index c8e0aa85fb8e..fdbab72926bd 100644
--- a/drivers/net/usb/ax88172a.c
+++ b/drivers/net/usb/ax88172a.c
@@ -377,7 +377,7 @@ static int ax88172a_reset(struct usbnet *dev)
377 377
378 priv->phydev = phy_connect(dev->net, priv->phy_name, 378 priv->phydev = phy_connect(dev->net, priv->phy_name,
379 &ax88172a_adjust_link, 379 &ax88172a_adjust_link,
380 0, PHY_INTERFACE_MODE_MII); 380 PHY_INTERFACE_MODE_MII);
381 if (IS_ERR(priv->phydev)) { 381 if (IS_ERR(priv->phydev)) {
382 netdev_err(dev->net, "Could not connect to PHY device %s\n", 382 netdev_err(dev->net, "Could not connect to PHY device %s\n",
383 priv->phy_name); 383 priv->phy_name);
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 83ca06f4312b..e3a8b22ef9dd 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -157,7 +157,7 @@ struct phy_device *of_phy_connect(struct net_device *dev,
157 if (!phy) 157 if (!phy)
158 return NULL; 158 return NULL;
159 159
160 return phy_connect_direct(dev, phy, hndlr, flags, iface) ? NULL : phy; 160 return phy_connect_direct(dev, phy, hndlr, iface) ? NULL : phy;
161} 161}
162EXPORT_SYMBOL(of_phy_connect); 162EXPORT_SYMBOL(of_phy_connect);
163 163
@@ -194,7 +194,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
194 194
195 sprintf(bus_id, PHY_ID_FMT, "fixed-0", be32_to_cpu(phy_id[0])); 195 sprintf(bus_id, PHY_ID_FMT, "fixed-0", be32_to_cpu(phy_id[0]));
196 196
197 phy = phy_connect(dev, bus_id, hndlr, 0, iface); 197 phy = phy_connect(dev, bus_id, hndlr, iface);
198 return IS_ERR(phy) ? NULL : phy; 198 return IS_ERR(phy) ? NULL : phy;
199} 199}
200EXPORT_SYMBOL(of_phy_connect_fixed_link); 200EXPORT_SYMBOL(of_phy_connect_fixed_link);
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index f15059ca3781..a0a30b3f2dcd 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -3917,7 +3917,7 @@ static int et131x_mii_probe(struct net_device *netdev)
3917 } 3917 }
3918 3918
3919 phydev = phy_connect(netdev, dev_name(&phydev->dev), 3919 phydev = phy_connect(netdev, dev_name(&phydev->dev),
3920 &et131x_adjust_link, 0, PHY_INTERFACE_MODE_MII); 3920 &et131x_adjust_link, PHY_INTERFACE_MODE_MII);
3921 3921
3922 if (IS_ERR(phydev)) { 3922 if (IS_ERR(phydev)) {
3923 dev_err(&adapter->pdev->dev, "Could not attach to PHY\n"); 3923 dev_err(&adapter->pdev->dev, "Could not attach to PHY\n");
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 93b3cf77f564..33999adbf8c8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -506,13 +506,13 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
506int phy_device_register(struct phy_device *phy); 506int phy_device_register(struct phy_device *phy);
507int phy_init_hw(struct phy_device *phydev); 507int phy_init_hw(struct phy_device *phydev);
508struct phy_device * phy_attach(struct net_device *dev, 508struct phy_device * phy_attach(struct net_device *dev,
509 const char *bus_id, u32 flags, phy_interface_t interface); 509 const char *bus_id, phy_interface_t interface);
510struct phy_device *phy_find_first(struct mii_bus *bus); 510struct phy_device *phy_find_first(struct mii_bus *bus);
511int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, 511int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
512 void (*handler)(struct net_device *), u32 flags, 512 void (*handler)(struct net_device *),
513 phy_interface_t interface); 513 phy_interface_t interface);
514struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 514struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
515 void (*handler)(struct net_device *), u32 flags, 515 void (*handler)(struct net_device *),
516 phy_interface_t interface); 516 phy_interface_t interface);
517void phy_disconnect(struct phy_device *phydev); 517void phy_disconnect(struct phy_device *phydev);
518void phy_detach(struct phy_device *phydev); 518void phy_detach(struct phy_device *phydev);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index f795b0ca7ee6..f4345582a6b9 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -391,7 +391,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
391 391
392 if (p->phy != NULL) { 392 if (p->phy != NULL) {
393 phy_attach(slave_dev, dev_name(&p->phy->dev), 393 phy_attach(slave_dev, dev_name(&p->phy->dev),
394 0, PHY_INTERFACE_MODE_GMII); 394 PHY_INTERFACE_MODE_GMII);
395 395
396 p->phy->autoneg = AUTONEG_ENABLE; 396 p->phy->autoneg = AUTONEG_ENABLE;
397 p->phy->speed = 0; 397 p->phy->speed = 0;