diff options
author | kirjanov@gmail.com <kirjanov@gmail.com> | 2010-02-16 16:54:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-17 18:59:47 -0500 |
commit | e4a474f82ddaaef65433b0b4f5169f2f6cd8ddb0 (patch) | |
tree | b98db85ea6a829c6d4a94152e267c04ae9201be0 | |
parent | e76b69cc0133952c98aa1ad6330cacacd269fd64 (diff) |
smsc911x: replace manual phy lookup.
Use phy_find_first() function instead of manual lookup.
Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
Reviewed-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/smsc911x.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index 3c1f9aa84cf5..13c0b76dec41 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -770,29 +770,25 @@ static int smsc911x_mii_probe(struct net_device *dev) | |||
770 | { | 770 | { |
771 | struct smsc911x_data *pdata = netdev_priv(dev); | 771 | struct smsc911x_data *pdata = netdev_priv(dev); |
772 | struct phy_device *phydev = NULL; | 772 | struct phy_device *phydev = NULL; |
773 | int phy_addr; | 773 | int ret; |
774 | 774 | ||
775 | /* find the first phy */ | 775 | /* find the first phy */ |
776 | for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { | 776 | phydev = phy_find_first(pdata->mii_bus); |
777 | if (pdata->mii_bus->phy_map[phy_addr]) { | ||
778 | phydev = pdata->mii_bus->phy_map[phy_addr]; | ||
779 | SMSC_TRACE(PROBE, "PHY %d: addr %d, phy_id 0x%08X", | ||
780 | phy_addr, phydev->addr, phydev->phy_id); | ||
781 | break; | ||
782 | } | ||
783 | } | ||
784 | |||
785 | if (!phydev) { | 777 | if (!phydev) { |
786 | pr_err("%s: no PHY found\n", dev->name); | 778 | pr_err("%s: no PHY found\n", dev->name); |
787 | return -ENODEV; | 779 | return -ENODEV; |
788 | } | 780 | } |
789 | 781 | ||
790 | phydev = phy_connect(dev, dev_name(&phydev->dev), | 782 | SMSC_TRACE(PROBE, "PHY %d: addr %d, phy_id 0x%08X", |
791 | &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface); | 783 | phy_addr, phydev->addr, phydev->phy_id); |
784 | |||
785 | ret = phy_connect_direct(dev, phydev, | ||
786 | &smsc911x_phy_adjust_link, 0, | ||
787 | pdata->config.phy_interface); | ||
792 | 788 | ||
793 | if (IS_ERR(phydev)) { | 789 | if (ret) { |
794 | pr_err("%s: Could not attach to PHY\n", dev->name); | 790 | pr_err("%s: Could not attach to PHY\n", dev->name); |
795 | return PTR_ERR(phydev); | 791 | return ret; |
796 | } | 792 | } |
797 | 793 | ||
798 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", | 794 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", |