diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2012-07-03 23:14:13 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-09 00:03:06 -0700 |
commit | 03fc4721cd96753696a988a2ba563f9f08ad4e9f (patch) | |
tree | e02851168b70a9fa22d7bc9186688387031a3028 /drivers | |
parent | ed1062772531b6e1029fa4ca62dc8d61f6d53d1c (diff) |
net/macb: manage carrier state with call to netif_carrier_{on|off}()
OFF carrier state is setup in probe() open() and suspend() functions.
The carrier ON state is managed in macb_handle_link_change().
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 1466bc4e3dda..033064b7b576 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -179,13 +179,16 @@ static void macb_handle_link_change(struct net_device *dev) spin_unlock_irqrestore(&bp->lock, flags); if (status_change) { - if (phydev->link) + if (phydev->link) { + netif_carrier_on(dev); netdev_info(dev, "link up (%d/%s)\n", phydev->speed, phydev->duplex == DUPLEX_FULL ? "Full" : "Half"); - else + } else { + netif_carrier_off(dev); netdev_info(dev, "link down\n"); + } } } @@ -1033,6 +1036,9 @@ static int macb_open(struct net_device *dev) netdev_dbg(bp->dev, "open\n"); + /* carrier starts down */ + netif_carrier_off(dev); + /* if the phy is not yet register, retry later*/ if (!bp->phy_dev) return -EAGAIN; @@ -1406,6 +1412,8 @@ static int __init macb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); + netif_carrier_off(dev); + netdev_info(dev, "Cadence %s at 0x%08lx irq %d (%pM)\n", macb_is_gem(bp) ? "GEM" : "MACB", dev->base_addr, dev->irq, dev->dev_addr); @@ -1469,6 +1477,7 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state) struct net_device *netdev = platform_get_drvdata(pdev); struct macb *bp = netdev_priv(netdev); + netif_carrier_off(netdev); netif_device_detach(netdev); clk_disable(bp->hclk); |