diff options
author | David S. Miller <davem@davemloft.net> | 2014-10-30 15:49:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-30 15:49:05 -0400 |
commit | 83810a9a6af310e413ce649c6ca2df2b4946e5a4 (patch) | |
tree | 11c87eb8affe17bacfb56ac2b1c5f553d441e3db | |
parent | d70127e8a942364de8dd140fe73893efda363293 (diff) | |
parent | e3bd1a81cd1e3f8ed961e642e97206d715db06c4 (diff) |
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: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/r8152.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index e3d84c322e4e..ca3c5d5f93eb 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -2891,6 +2891,9 @@ static int rtl8152_open(struct net_device *netdev) | |||
2891 | if (res) | 2891 | if (res) |
2892 | goto out; | 2892 | goto out; |
2893 | 2893 | ||
2894 | /* set speed to 0 to avoid autoresume try to submit rx */ | ||
2895 | tp->speed = 0; | ||
2896 | |||
2894 | res = usb_autopm_get_interface(tp->intf); | 2897 | res = usb_autopm_get_interface(tp->intf); |
2895 | if (res < 0) { | 2898 | if (res < 0) { |
2896 | free_all_mem(tp); | 2899 | free_all_mem(tp); |
@@ -2904,6 +2907,8 @@ static int rtl8152_open(struct net_device *netdev) | |||
2904 | clear_bit(WORK_ENABLE, &tp->flags); | 2907 | clear_bit(WORK_ENABLE, &tp->flags); |
2905 | usb_kill_urb(tp->intr_urb); | 2908 | usb_kill_urb(tp->intr_urb); |
2906 | cancel_delayed_work_sync(&tp->schedule); | 2909 | cancel_delayed_work_sync(&tp->schedule); |
2910 | |||
2911 | /* disable the tx/rx, if the workqueue has enabled them. */ | ||
2907 | if (tp->speed & LINK_STATUS) | 2912 | if (tp->speed & LINK_STATUS) |
2908 | tp->rtl_ops.disable(tp); | 2913 | tp->rtl_ops.disable(tp); |
2909 | } | 2914 | } |
@@ -2955,10 +2960,7 @@ static int rtl8152_close(struct net_device *netdev) | |||
2955 | * be disable when autoresume occurs, because the | 2960 | * be disable when autoresume occurs, because the |
2956 | * netif_running() would be false. | 2961 | * netif_running() would be false. |
2957 | */ | 2962 | */ |
2958 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 2963 | rtl_runtime_suspend_enable(tp, false); |
2959 | rtl_runtime_suspend_enable(tp, false); | ||
2960 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | ||
2961 | } | ||
2962 | 2964 | ||
2963 | tasklet_disable(&tp->tl); | 2965 | tasklet_disable(&tp->tl); |
2964 | tp->rtl_ops.down(tp); | 2966 | tp->rtl_ops.down(tp); |
@@ -3205,7 +3207,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
3205 | netif_device_detach(netdev); | 3207 | netif_device_detach(netdev); |
3206 | } | 3208 | } |
3207 | 3209 | ||
3208 | if (netif_running(netdev)) { | 3210 | if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) { |
3209 | clear_bit(WORK_ENABLE, &tp->flags); | 3211 | clear_bit(WORK_ENABLE, &tp->flags); |
3210 | usb_kill_urb(tp->intr_urb); | 3212 | usb_kill_urb(tp->intr_urb); |
3211 | tasklet_disable(&tp->tl); | 3213 | tasklet_disable(&tp->tl); |
@@ -3253,6 +3255,8 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
3253 | set_bit(WORK_ENABLE, &tp->flags); | 3255 | set_bit(WORK_ENABLE, &tp->flags); |
3254 | } | 3256 | } |
3255 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3257 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
3258 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | ||
3259 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | ||
3256 | } | 3260 | } |
3257 | 3261 | ||
3258 | mutex_unlock(&tp->control); | 3262 | mutex_unlock(&tp->control); |