Skip to content

Commit

Permalink
net: ethernet: faraday: Use phy_find_first() instead of open coding it
Browse files Browse the repository at this point in the history
Use phy_find_first() to find the first phy device instead of
open coding it.

Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Guenter Roeck authored and David S. Miller committed Jan 11, 2016
1 parent ee64f08 commit e574f39
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions drivers/net/ethernet/faraday/ftgmac100.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,20 +834,9 @@ static void ftgmac100_adjust_link(struct net_device *netdev)
static int ftgmac100_mii_probe(struct ftgmac100 *priv)
{
struct net_device *netdev = priv->netdev;
struct phy_device *phydev = NULL;
int i;

/* search for connect PHY device */
for (i = 0; i < PHY_MAX_ADDR; i++) {
struct phy_device *tmp = mdiobus_get_phy(priv->mii_bus, i);

if (tmp) {
phydev = tmp;
break;
}
}
struct phy_device *phydev;

/* now we are supposed to have a proper phydev, to attach to... */
phydev = phy_find_first(priv->mii_bus);
if (!phydev) {
netdev_info(netdev, "%s: no PHY found\n", netdev->name);
return -ENODEV;
Expand Down

0 comments on commit e574f39

Please sign in to comment.