static void rtl_reset_work(struct rtl8169_private *tp)
{
- struct net_device *dev = tp->dev;
int i;
- netif_stop_queue(dev);
+ netif_stop_queue(tp->dev);
rtl8169_cleanup(tp, false);
napi_enable(&tp->napi);
rtl_hw_start(tp);
- netif_wake_queue(dev);
}
static void rtl8169_tx_timeout(struct net_device *dev, unsigned int txqueue)
!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
goto out_unlock;
- if (test_and_clear_bit(RTL_FLAG_TASK_RESET_PENDING, tp->wk.flags))
+ if (test_and_clear_bit(RTL_FLAG_TASK_RESET_PENDING, tp->wk.flags)) {
rtl_reset_work(tp);
+ netif_wake_queue(tp->dev);
+ }
out_unlock:
rtl_unlock_work(tp);
}
static void rtl8169_net_suspend(struct rtl8169_private *tp)
{
- if (!netif_running(tp->dev))
- return;
-
netif_device_detach(tp->dev);
- rtl8169_down(tp);
+
+ if (netif_running(tp->dev))
+ rtl8169_down(tp);
}
#ifdef CONFIG_PM
static void __rtl8169_resume(struct rtl8169_private *tp)
{
- netif_device_attach(tp->dev);
-
rtl_pll_power_up(tp);
rtl8169_init_phy(tp);
if (netif_running(tp->dev))
__rtl8169_resume(tp);
+ netif_device_attach(tp->dev);
+
return 0;
}
{
struct rtl8169_private *tp = dev_get_drvdata(device);
- if (!tp->TxDescArray)
+ if (!tp->TxDescArray) {
+ netif_device_detach(tp->dev);
return 0;
+ }
rtl_lock_work(tp);
__rtl8169_set_wol(tp, WAKE_PHY);
if (tp->TxDescArray)
__rtl8169_resume(tp);
+ netif_device_attach(tp->dev);
+
return 0;
}