Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[platform/kernel/linux-starfive.git] / drivers / net / usb / usbnet.c
index 78a9275..e415465 100644 (file)
@@ -17,9 +17,6 @@
  * issues can usefully be addressed by this framework.
  */
 
-// #define     DEBUG                   // error path messages, extra info
-// #define     VERBOSE                 // more; success messages
-
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/netdevice.h>
@@ -337,8 +334,8 @@ void usbnet_skb_return (struct usbnet *dev, struct sk_buff *skb)
                skb->protocol = eth_type_trans (skb, dev->net);
 
        flags = u64_stats_update_begin_irqsave(&stats64->syncp);
-       stats64->rx_packets++;
-       stats64->rx_bytes += skb->len;
+       u64_stats_inc(&stats64->rx_packets);
+       u64_stats_add(&stats64->rx_bytes, skb->len);
        u64_stats_update_end_irqrestore(&stats64->syncp, flags);
 
        netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
@@ -849,13 +846,11 @@ int usbnet_stop (struct net_device *net)
 
        mpn = !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags);
 
-       /* deferred work (task, timer, softirq) must also stop.
-        * can't flush_scheduled_work() until we drop rtnl (later),
-        * else workers could deadlock; so make workers a NOP.
-        */
+       /* deferred work (timer, softirq, task) must also stop */
        dev->flags = 0;
        del_timer_sync (&dev->delay);
        tasklet_kill (&dev->bh);
+       cancel_work_sync(&dev->kevent);
        if (!pm)
                usb_autopm_put_interface(dev->intf);
 
@@ -1258,8 +1253,8 @@ static void tx_complete (struct urb *urb)
                unsigned long flags;
 
                flags = u64_stats_update_begin_irqsave(&stats64->syncp);
-               stats64->tx_packets += entry->packets;
-               stats64->tx_bytes += entry->length;
+               u64_stats_add(&stats64->tx_packets, entry->packets);
+               u64_stats_add(&stats64->tx_bytes, entry->length);
                u64_stats_update_end_irqrestore(&stats64->syncp, flags);
        } else {
                dev->net->stats.tx_errors++;
@@ -1619,8 +1614,6 @@ void usbnet_disconnect (struct usb_interface *intf)
        net = dev->net;
        unregister_netdev (net);
 
-       cancel_work_sync(&dev->kevent);
-
        usb_scuttle_anchored_urbs(&dev->deferred);
 
        if (dev->driver_info->unbind)