container_of(work,
struct fec_enet_private,
delay_work.delay_work.work);
+ struct net_device *ndev = fep->netdev;
if (fep->delay_work.timeout) {
fep->delay_work.timeout = false;
rtnl_lock();
- fec_restart(fep->netdev, fep->full_duplex);
- netif_wake_queue(fep->netdev);
+ if (netif_device_present(ndev) || netif_running(ndev)) {
+ fec_restart(ndev, fep->full_duplex);
+ netif_wake_queue(ndev);
+ }
rtnl_unlock();
}
return;
}
- if (phy_dev->link) {
+ /*
+ * If the netdev is down, or is going down, we're not interested
+ * in link state events, so just mark our idea of the link as down
+ * and ignore the event.
+ */
+ if (!netif_running(ndev) || !netif_device_present(ndev)) {
+ fep->link = 0;
+ } else if (phy_dev->link) {
if (!fep->link) {
fep->link = phy_dev->link;
status_change = 1;
return ret;
}
+ fec_restart(ndev, fep->full_duplex);
napi_enable(&fep->napi);
phy_start(fep->phy_dev);
netif_start_queue(ndev);
fec_stop(netdev);
fec_restart(netdev, fep->phy_dev->duplex);
netif_wake_queue(netdev);
- } else {
- fec_restart(netdev, fep->phy_dev->duplex);
}
}