Commit 83810a9a authored by David S. Miller's avatar David S. Miller

Merge branch 'r8152-net'

Hayes Wang says:

====================
r8152: patches for autosuspend

There are unexpected processes when enabling autosuspend.
These patches are used to fix them.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d70127e8 e3bd1a81
...@@ -2891,6 +2891,9 @@ static int rtl8152_open(struct net_device *netdev) ...@@ -2891,6 +2891,9 @@ static int rtl8152_open(struct net_device *netdev)
if (res) if (res)
goto out; goto out;
/* set speed to 0 to avoid autoresume try to submit rx */
tp->speed = 0;
res = usb_autopm_get_interface(tp->intf); res = usb_autopm_get_interface(tp->intf);
if (res < 0) { if (res < 0) {
free_all_mem(tp); free_all_mem(tp);
...@@ -2904,6 +2907,8 @@ static int rtl8152_open(struct net_device *netdev) ...@@ -2904,6 +2907,8 @@ static int rtl8152_open(struct net_device *netdev)
clear_bit(WORK_ENABLE, &tp->flags); clear_bit(WORK_ENABLE, &tp->flags);
usb_kill_urb(tp->intr_urb); usb_kill_urb(tp->intr_urb);
cancel_delayed_work_sync(&tp->schedule); cancel_delayed_work_sync(&tp->schedule);
/* disable the tx/rx, if the workqueue has enabled them. */
if (tp->speed & LINK_STATUS) if (tp->speed & LINK_STATUS)
tp->rtl_ops.disable(tp); tp->rtl_ops.disable(tp);
} }
...@@ -2955,10 +2960,7 @@ static int rtl8152_close(struct net_device *netdev) ...@@ -2955,10 +2960,7 @@ static int rtl8152_close(struct net_device *netdev)
* be disable when autoresume occurs, because the * be disable when autoresume occurs, because the
* netif_running() would be false. * netif_running() would be false.
*/ */
if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { rtl_runtime_suspend_enable(tp, false);
rtl_runtime_suspend_enable(tp, false);
clear_bit(SELECTIVE_SUSPEND, &tp->flags);
}
tasklet_disable(&tp->tl); tasklet_disable(&tp->tl);
tp->rtl_ops.down(tp); tp->rtl_ops.down(tp);
...@@ -3205,7 +3207,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -3205,7 +3207,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
netif_device_detach(netdev); netif_device_detach(netdev);
} }
if (netif_running(netdev)) { if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
clear_bit(WORK_ENABLE, &tp->flags); clear_bit(WORK_ENABLE, &tp->flags);
usb_kill_urb(tp->intr_urb); usb_kill_urb(tp->intr_urb);
tasklet_disable(&tp->tl); tasklet_disable(&tp->tl);
...@@ -3253,6 +3255,8 @@ static int rtl8152_resume(struct usb_interface *intf) ...@@ -3253,6 +3255,8 @@ static int rtl8152_resume(struct usb_interface *intf)
set_bit(WORK_ENABLE, &tp->flags); set_bit(WORK_ENABLE, &tp->flags);
} }
usb_submit_urb(tp->intr_urb, GFP_KERNEL); usb_submit_urb(tp->intr_urb, GFP_KERNEL);
} else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
clear_bit(SELECTIVE_SUSPEND, &tp->flags);
} }
mutex_unlock(&tp->control); mutex_unlock(&tp->control);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment