]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/net/wireless/realtek/rtlwifi/usb.c
Merge tag 'wireless-drivers-next-for-davem-2017-02-01' of git://git.kernel.org/pub...
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / realtek / rtlwifi / usb.c
index 916a230aeeaaaf869bfeda189782840806e52eca..4d989b8ab185681aa500b4e7de7fc34260f904a9 100644 (file)
@@ -818,12 +818,30 @@ static void rtl_usb_stop(struct ieee80211_hw *hw)
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
        struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw));
+       struct urb *urb;
 
        /* should after adapter start and interrupt enable. */
        set_hal_stop(rtlhal);
        cancel_work_sync(&rtlpriv->works.fill_h2c_cmd);
        /* Enable software */
        SET_USB_STOP(rtlusb);
+
+       /* free pre-allocated URBs from rtl_usb_start() */
+       usb_kill_anchored_urbs(&rtlusb->rx_submitted);
+
+       tasklet_kill(&rtlusb->rx_work_tasklet);
+       cancel_work_sync(&rtlpriv->works.lps_change_work);
+
+       flush_workqueue(rtlpriv->works.rtl_wq);
+
+       skb_queue_purge(&rtlusb->rx_queue);
+
+       while ((urb = usb_get_from_anchor(&rtlusb->rx_cleanup_urbs))) {
+               usb_free_coherent(urb->dev, urb->transfer_buffer_length,
+                               urb->transfer_buffer, urb->transfer_dma);
+               usb_free_urb(urb);
+       }
+
        rtlpriv->cfg->ops->hw_disable(hw);
 }
 
@@ -1074,7 +1092,6 @@ int rtl_usb_probe(struct usb_interface *intf,
        rtlpriv->rtlhal.interface = INTF_USB;
        rtlpriv->cfg = rtl_hal_cfg;
        rtlpriv->intf_ops = &rtl_usb_ops;
-       rtl_dbgp_flag_init(hw);
        /* Init IO handler */
        _rtl_usb_io_handler_init(&udev->dev, hw);
        rtlpriv->cfg->ops->read_chip_version(hw);