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.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e3d84c322e4e..c6554c7a8147 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -1162,6 +1162,9 @@ static void intr_callback(struct urb *urb)
1162 case -ESHUTDOWN: 1162 case -ESHUTDOWN:
1163 netif_device_detach(tp->netdev); 1163 netif_device_detach(tp->netdev);
1164 case -ENOENT: 1164 case -ENOENT:
1165 case -EPROTO:
1166 netif_info(tp, intr, tp->netdev,
1167 "Stop submitting intr, status %d\n", status);
1165 return; 1168 return;
1166 case -EOVERFLOW: 1169 case -EOVERFLOW:
1167 netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); 1170 netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n");
@@ -2891,6 +2894,9 @@ static int rtl8152_open(struct net_device *netdev)
2891 if (res) 2894 if (res)
2892 goto out; 2895 goto out;
2893 2896
2897 /* set speed to 0 to avoid autoresume try to submit rx */
2898 tp->speed = 0;
2899
2894 res = usb_autopm_get_interface(tp->intf); 2900 res = usb_autopm_get_interface(tp->intf);
2895 if (res < 0) { 2901 if (res < 0) {
2896 free_all_mem(tp); 2902 free_all_mem(tp);
@@ -2904,6 +2910,8 @@ static int rtl8152_open(struct net_device *netdev)
2904 clear_bit(WORK_ENABLE, &tp->flags); 2910 clear_bit(WORK_ENABLE, &tp->flags);
2905 usb_kill_urb(tp->intr_urb); 2911 usb_kill_urb(tp->intr_urb);
2906 cancel_delayed_work_sync(&tp->schedule); 2912 cancel_delayed_work_sync(&tp->schedule);
2913
2914 /* disable the tx/rx, if the workqueue has enabled them. */
2907 if (tp->speed & LINK_STATUS) 2915 if (tp->speed & LINK_STATUS)
2908 tp->rtl_ops.disable(tp); 2916 tp->rtl_ops.disable(tp);
2909 } 2917 }
@@ -2955,10 +2963,7 @@ static int rtl8152_close(struct net_device *netdev)
2955 * be disable when autoresume occurs, because the 2963 * be disable when autoresume occurs, because the
2956 * netif_running() would be false. 2964 * netif_running() would be false.
2957 */ 2965 */
2958 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { 2966 rtl_runtime_suspend_enable(tp, false);
2959 rtl_runtime_suspend_enable(tp, false);
2960 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
2961 }
2962 2967
2963 tasklet_disable(&tp->tl); 2968 tasklet_disable(&tp->tl);
2964 tp->rtl_ops.down(tp); 2969 tp->rtl_ops.down(tp);
@@ -3205,7 +3210,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
3205 netif_device_detach(netdev); 3210 netif_device_detach(netdev);
3206 } 3211 }
3207 3212
3208 if (netif_running(netdev)) { 3213 if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
3209 clear_bit(WORK_ENABLE, &tp->flags); 3214 clear_bit(WORK_ENABLE, &tp->flags);
3210 usb_kill_urb(tp->intr_urb); 3215 usb_kill_urb(tp->intr_urb);
3211 tasklet_disable(&tp->tl); 3216 tasklet_disable(&tp->tl);
@@ -3253,6 +3258,8 @@ static int rtl8152_resume(struct usb_interface *intf)
3253 set_bit(WORK_ENABLE, &tp->flags); 3258 set_bit(WORK_ENABLE, &tp->flags);
3254 } 3259 }
3255 usb_submit_urb(tp->intr_urb, GFP_KERNEL); 3260 usb_submit_urb(tp->intr_urb, GFP_KERNEL);
3261 } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
3262 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
3256 } 3263 }
3257 3264
3258 mutex_unlock(&tp->control); 3265 mutex_unlock(&tp->control);