net: dnet: Use phy_find_first() helper
[cascardo/linux.git] / drivers / net / ethernet / dnet.c
index 13d00a3..0ec3675 100644 (file)
@@ -255,15 +255,9 @@ static int dnet_mii_probe(struct net_device *dev)
 {
        struct dnet *bp = netdev_priv(dev);
        struct phy_device *phydev = NULL;
-       int phy_addr;
 
        /* find the first phy */
-       for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
-               if (bp->mii_bus->phy_map[phy_addr]) {
-                       phydev = bp->mii_bus->phy_map[phy_addr];
-                       break;
-               }
-       }
+       phydev = phy_find_first(bp->mii_bus);
 
        if (!phydev) {
                printk(KERN_ERR "%s: no PHY found\n", dev->name);
@@ -274,11 +268,11 @@ static int dnet_mii_probe(struct net_device *dev)
 
        /* attach the mac to the phy */
        if (bp->capabilities & DNET_HAS_RMII) {
-               phydev = phy_connect(dev, dev_name(&phydev->dev),
+               phydev = phy_connect(dev, phydev_name(phydev),
                                     &dnet_handle_link_change,
                                     PHY_INTERFACE_MODE_RMII);
        } else {
-               phydev = phy_connect(dev, dev_name(&phydev->dev),
+               phydev = phy_connect(dev, phydev_name(phydev),
                                     &dnet_handle_link_change,
                                     PHY_INTERFACE_MODE_MII);
        }
@@ -894,7 +888,7 @@ static int dnet_probe(struct platform_device *pdev)
        phydev = bp->phy_dev;
        dev_info(&pdev->dev, "attached PHY driver [%s] "
               "(mii_bus:phy_addr=%s, irq=%d)\n",
-              phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+              phydev->drv->name, phydev_name(phydev), phydev->irq);
 
        return 0;