aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethoc.c
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2010-06-10 22:47:37 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-11 16:28:35 -0400
commit637f33b80d774060646772a22fd728e198d9ebf9 (patch)
tree6a88fc51ea69bb8a9a7f0da22092f99204108e77 /drivers/net/ethoc.c
parentee4f56b990391f0ea333121ebc0e9fba28619b52 (diff)
ethoc: Clean up PHY probing
- No need to iterate over all possible addresses on bus - Use helper function phy_find_first - Use phy_connect_direct as we already have the relevant structure Signed-off-by: Jonas Bonn <jonas@southpole.se> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethoc.c')
-rw-r--r--drivers/net/ethoc.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index afeb9938ff85..1ee9947924d8 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -635,21 +635,13 @@ static int ethoc_mdio_probe(struct net_device *dev)
635{ 635{
636 struct ethoc *priv = netdev_priv(dev); 636 struct ethoc *priv = netdev_priv(dev);
637 struct phy_device *phy; 637 struct phy_device *phy;
638 int err;
638 int i; 639 int i;
639 640
640 for (i = 0; i < PHY_MAX_ADDR; i++) { 641 if (priv->phy_id != -1) {
641 phy = priv->mdio->phy_map[i]; 642 phy = priv->mdio->phy_map[priv->phy_id];
642 if (phy) { 643 } else {
643 if (priv->phy_id != -1) { 644 phy = phy_find_first(priv->mdio);
644 /* attach to specified PHY */
645 if (priv->phy_id == phy->addr)
646 break;
647 } else {
648 /* autoselect PHY if none was specified */
649 if (phy->addr != 0)
650 break;
651 }
652 }
653 } 645 }
654 646
655 if (!phy) { 647 if (!phy) {
@@ -657,11 +649,11 @@ static int ethoc_mdio_probe(struct net_device *dev)
657 return -ENXIO; 649 return -ENXIO;
658 } 650 }
659 651
660 phy = phy_connect(dev, dev_name(&phy->dev), ethoc_mdio_poll, 0, 652 err = phy_connect_direct(dev, phy, ethoc_mdio_poll, 0,
661 PHY_INTERFACE_MODE_GMII); 653 PHY_INTERFACE_MODE_GMII);
662 if (IS_ERR(phy)) { 654 if (err) {
663 dev_err(&dev->dev, "could not attach to PHY\n"); 655 dev_err(&dev->dev, "could not attach to PHY\n");
664 return PTR_ERR(phy); 656 return err;
665 } 657 }
666 658
667 priv->phy = phy; 659 priv->phy = phy;