net: ethernet: faraday: Use phy_find_first() instead of open coding it
Subsystems (2)
PATCH 1/1 net: ethernet: faraday: Use phy_find_first() instead of open coding it
Use phy_find_first() to find the first phy device instead of open coding it.
Cc Andrew Lunn <[email protected]>
Signed-off-by Guenter Roeck <[email protected]>
--- drivers/net/ethernet/faraday/ftgmac100.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +2 -13
@@ -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 ;
Signature · 1 line
2.1.4
Quoted 5 lines · Guenter Roeck
Use
phy_find_first()to find the first phy device instead of open coding it.Cc Andrew Lunn <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Acked-by Andrew Lunn <[email protected]>
Thanks
Andrew
Quoted 34 lines
--- drivers/net/ethernet/faraday/ftgmac100.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)drivers/net/ethernet/faraday/ftgmac100.c +2
-13@@ -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 ;Signature · 1 line
2.1.4
From: Guenter Roeck <[email protected]>
Date: Sun, 10 Jan 2016 12:04:32 -0800
Quoted 5 lines
Use
phy_find_first()to find the first phy device instead of open coding it.Cc Andrew Lunn <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Applied.