mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
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>
This commit is contained in:
parent
c7621cb3d9
commit
1273d97674
1 changed files with 5 additions and 11 deletions
|
@ -679,30 +679,24 @@ static int fec_enet_mii_probe(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct fec_enet_private *fep = netdev_priv(dev);
|
struct fec_enet_private *fep = netdev_priv(dev);
|
||||||
struct phy_device *phy_dev = NULL;
|
struct phy_device *phy_dev = NULL;
|
||||||
int phy_addr;
|
int ret;
|
||||||
|
|
||||||
fep->phy_dev = NULL;
|
fep->phy_dev = NULL;
|
||||||
|
|
||||||
/* find the first phy */
|
/* find the first phy */
|
||||||
for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
|
phy_dev = phy_find_first(fep->mii_bus);
|
||||||
if (fep->mii_bus->phy_map[phy_addr]) {
|
|
||||||
phy_dev = fep->mii_bus->phy_map[phy_addr];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!phy_dev) {
|
if (!phy_dev) {
|
||||||
printk(KERN_ERR "%s: no PHY found\n", dev->name);
|
printk(KERN_ERR "%s: no PHY found\n", dev->name);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attach the mac to the phy */
|
/* attach the mac to the phy */
|
||||||
phy_dev = phy_connect(dev, dev_name(&phy_dev->dev),
|
ret = phy_connect_direct(dev, phy_dev,
|
||||||
&fec_enet_adjust_link, 0,
|
&fec_enet_adjust_link, 0,
|
||||||
PHY_INTERFACE_MODE_MII);
|
PHY_INTERFACE_MODE_MII);
|
||||||
if (IS_ERR(phy_dev)) {
|
if (ret) {
|
||||||
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
|
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
|
||||||
return PTR_ERR(phy_dev);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mask with MAC supported features */
|
/* mask with MAC supported features */
|
||||||
|
|
Loading…
Reference in a new issue