diff options
author | Denis Kirjanov <dkirjanov@hera.kernel.org> | 2010-06-02 05:17:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-03 06:18:21 -0400 |
commit | 1273d97674a1782ff55b823aa6c40aea9b538aaf (patch) | |
tree | c4030975260322e0a6e1b3ac102aeeefd201c233 | |
parent | c7621cb3d9a2c42d2fed7e16845611c8c6fd5835 (diff) |
fec: Cleanup PHY probing
Cleanup PHY probing: use helpers from phylib
Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/fec.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index b896f686ab34..25df1b860c0b 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -679,30 +679,24 @@ static int fec_enet_mii_probe(struct net_device *dev) | |||
679 | { | 679 | { |
680 | struct fec_enet_private *fep = netdev_priv(dev); | 680 | struct fec_enet_private *fep = netdev_priv(dev); |
681 | struct phy_device *phy_dev = NULL; | 681 | struct phy_device *phy_dev = NULL; |
682 | int phy_addr; | 682 | int ret; |
683 | 683 | ||
684 | fep->phy_dev = NULL; | 684 | fep->phy_dev = NULL; |
685 | 685 | ||
686 | /* find the first phy */ | 686 | /* find the first phy */ |
687 | for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { | 687 | phy_dev = phy_find_first(fep->mii_bus); |
688 | if (fep->mii_bus->phy_map[phy_addr]) { | ||
689 | phy_dev = fep->mii_bus->phy_map[phy_addr]; | ||
690 | break; | ||
691 | } | ||
692 | } | ||
693 | |||
694 | if (!phy_dev) { | 688 | if (!phy_dev) { |
695 | printk(KERN_ERR "%s: no PHY found\n", dev->name); | 689 | printk(KERN_ERR "%s: no PHY found\n", dev->name); |
696 | return -ENODEV; | 690 | return -ENODEV; |
697 | } | 691 | } |
698 | 692 | ||
699 | /* attach the mac to the phy */ | 693 | /* attach the mac to the phy */ |
700 | phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), | 694 | ret = phy_connect_direct(dev, phy_dev, |
701 | &fec_enet_adjust_link, 0, | 695 | &fec_enet_adjust_link, 0, |
702 | PHY_INTERFACE_MODE_MII); | 696 | PHY_INTERFACE_MODE_MII); |
703 | if (IS_ERR(phy_dev)) { | 697 | if (ret) { |
704 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 698 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); |
705 | return PTR_ERR(phy_dev); | 699 | return ret; |
706 | } | 700 | } |
707 | 701 | ||
708 | /* mask with MAC supported features */ | 702 | /* mask with MAC supported features */ |