Skip to content

Commit

Permalink
r8152: disable the tasklet by default
Browse files Browse the repository at this point in the history
Let the tasklet only be enabled after open(), and be disabled for
the other situation. The tasklet is only necessary after open() for
tx/rx, so it could be disabled by default.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
hayeswang authored and David S. Miller committed Nov 6, 2014
1 parent 4c672e4 commit 93ffbea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/usb/r8152.c
Original file line number Diff line number Diff line change
Expand Up @@ -2943,6 +2943,8 @@ static int rtl8152_open(struct net_device *netdev)
netif_warn(tp, ifup, netdev, "intr_urb submit failed: %d\n",
res);
free_all_mem(tp);
} else {
tasklet_enable(&tp->tl);
}

mutex_unlock(&tp->control);
Expand All @@ -2958,6 +2960,7 @@ static int rtl8152_close(struct net_device *netdev)
struct r8152 *tp = netdev_priv(netdev);
int res = 0;

tasklet_disable(&tp->tl);
clear_bit(WORK_ENABLE, &tp->flags);
usb_kill_urb(tp->intr_urb);
cancel_delayed_work_sync(&tp->schedule);
Expand All @@ -2975,9 +2978,7 @@ static int rtl8152_close(struct net_device *netdev)
*/
rtl_runtime_suspend_enable(tp, false);

tasklet_disable(&tp->tl);
tp->rtl_ops.down(tp);
tasklet_enable(&tp->tl);

mutex_unlock(&tp->control);

Expand Down Expand Up @@ -3887,12 +3888,15 @@ static int rtl8152_probe(struct usb_interface *intf,
else
device_set_wakeup_enable(&udev->dev, false);

tasklet_disable(&tp->tl);

netif_info(tp, probe, netdev, "%s\n", DRIVER_VERSION);

return 0;

out1:
usb_set_intfdata(intf, NULL);
tasklet_kill(&tp->tl);
out:
free_netdev(netdev);
return ret;
Expand Down

0 comments on commit 93ffbea

Please sign in to comment.