net: dnet: Use phy_find_first() helper
authorAndrew Lunn <andrew@lunn.ch>
Wed, 6 Jan 2016 19:11:11 +0000 (20:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Jan 2016 19:31:25 +0000 (14:31 -0500)
Replace the open coded search for the first phy with a call to the
existing helper function.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/dnet.c

index 136b6010f704b80157d9dfa3af7ee86699423102..0ec3675213541417d3afe86622536e8de752ab0f 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);