Commit a1f83fee authored by hayeswang's avatar hayeswang Committed by David S. Miller

r8152: check RTL8152_UNPLUG and netif_running before autoresume

If the device is unplugged or !netif_running(), the workqueue
doesn't need to wake the device, and could return directly.
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9451a11c
...@@ -2857,15 +2857,18 @@ static void rtl_work_func_t(struct work_struct *work) ...@@ -2857,15 +2857,18 @@ static void rtl_work_func_t(struct work_struct *work)
{ {
struct r8152 *tp = container_of(work, struct r8152, schedule.work); struct r8152 *tp = container_of(work, struct r8152, schedule.work);
/* If the device is unplugged or !netif_running(), the workqueue
* doesn't need to wake the device, and could return directly.
*/
if (test_bit(RTL8152_UNPLUG, &tp->flags) || !netif_running(tp->netdev))
return;
if (usb_autopm_get_interface(tp->intf) < 0) if (usb_autopm_get_interface(tp->intf) < 0)
return; return;
if (!test_bit(WORK_ENABLE, &tp->flags)) if (!test_bit(WORK_ENABLE, &tp->flags))
goto out1; goto out1;
if (test_bit(RTL8152_UNPLUG, &tp->flags))
goto out1;
if (!mutex_trylock(&tp->control)) { if (!mutex_trylock(&tp->control)) {
schedule_delayed_work(&tp->schedule, 0); schedule_delayed_work(&tp->schedule, 0);
goto out1; goto out1;
......
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