aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/r8152.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/r8152.c')
-rw-r--r--drivers/net/usb/r8152.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index d9427ca3dba7..2e32c41536ae 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3067,17 +3067,6 @@ static int rtl8152_open(struct net_device *netdev)
3067 3067
3068 mutex_lock(&tp->control); 3068 mutex_lock(&tp->control);
3069 3069
3070 /* The WORK_ENABLE may be set when autoresume occurs */
3071 if (test_bit(WORK_ENABLE, &tp->flags)) {
3072 clear_bit(WORK_ENABLE, &tp->flags);
3073 usb_kill_urb(tp->intr_urb);
3074 cancel_delayed_work_sync(&tp->schedule);
3075
3076 /* disable the tx/rx, if the workqueue has enabled them. */
3077 if (netif_carrier_ok(netdev))
3078 tp->rtl_ops.disable(tp);
3079 }
3080
3081 tp->rtl_ops.up(tp); 3070 tp->rtl_ops.up(tp);
3082 3071
3083 rtl8152_set_speed(tp, AUTONEG_ENABLE, 3072 rtl8152_set_speed(tp, AUTONEG_ENABLE,
@@ -3124,12 +3113,6 @@ static int rtl8152_close(struct net_device *netdev)
3124 } else { 3113 } else {
3125 mutex_lock(&tp->control); 3114 mutex_lock(&tp->control);
3126 3115
3127 /* The autosuspend may have been enabled and wouldn't
3128 * be disable when autoresume occurs, because the
3129 * netif_running() would be false.
3130 */
3131 rtl_runtime_suspend_enable(tp, false);
3132
3133 tp->rtl_ops.down(tp); 3116 tp->rtl_ops.down(tp);
3134 3117
3135 mutex_unlock(&tp->control); 3118 mutex_unlock(&tp->control);
@@ -3512,7 +3495,7 @@ static int rtl8152_resume(struct usb_interface *intf)
3512 netif_device_attach(tp->netdev); 3495 netif_device_attach(tp->netdev);
3513 } 3496 }
3514 3497
3515 if (netif_running(tp->netdev)) { 3498 if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) {
3516 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { 3499 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
3517 rtl_runtime_suspend_enable(tp, false); 3500 rtl_runtime_suspend_enable(tp, false);
3518 clear_bit(SELECTIVE_SUSPEND, &tp->flags); 3501 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
@@ -3532,6 +3515,8 @@ static int rtl8152_resume(struct usb_interface *intf)
3532 } 3515 }
3533 usb_submit_urb(tp->intr_urb, GFP_KERNEL); 3516 usb_submit_urb(tp->intr_urb, GFP_KERNEL);
3534 } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { 3517 } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
3518 if (tp->netdev->flags & IFF_UP)
3519 rtl_runtime_suspend_enable(tp, false);
3535 clear_bit(SELECTIVE_SUSPEND, &tp->flags); 3520 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
3536 } 3521 }
3537 3522