summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethoc.c
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2010-06-11 02:47:37 +0000
committerDavid S. Miller <davem@davemloft.net>2010-06-11 13:28:35 -0700
commit637f33b80d774060646772a22fd728e198d9ebf9 (patch)
tree6a88fc51ea69bb8a9a7f0da22092f99204108e77 /drivers/net/ethoc.c
parentee4f56b990391f0ea333121ebc0e9fba28619b52 (diff)
downloadlinux-637f33b80d774060646772a22fd728e198d9ebf9.tar.gz
linux-637f33b80d774060646772a22fd728e198d9ebf9.tar.bz2
linux-637f33b80d774060646772a22fd728e198d9ebf9.zip
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)
{
struct ethoc *priv = netdev_priv(dev);
struct phy_device *phy;
+ int err;
int i;
- for (i = 0; i < PHY_MAX_ADDR; i++) {
- phy = priv->mdio->phy_map[i];
- if (phy) {
- if (priv->phy_id != -1) {
- /* attach to specified PHY */
- if (priv->phy_id == phy->addr)
- break;
- } else {
- /* autoselect PHY if none was specified */
- if (phy->addr != 0)
- break;
- }
- }
+ if (priv->phy_id != -1) {
+ phy = priv->mdio->phy_map[priv->phy_id];
+ } else {
+ phy = phy_find_first(priv->mdio);
}
if (!phy) {
@@ -657,11 +649,11 @@ static int ethoc_mdio_probe(struct net_device *dev)
return -ENXIO;
}
- phy = phy_connect(dev, dev_name(&phy->dev), ethoc_mdio_poll, 0,
+ err = phy_connect_direct(dev, phy, ethoc_mdio_poll, 0,
PHY_INTERFACE_MODE_GMII);
- if (IS_ERR(phy)) {
+ if (err) {
dev_err(&dev->dev, "could not attach to PHY\n");
- return PTR_ERR(phy);
+ return err;
}
priv->phy = phy;