]> Pileus Git - ~andy/linux/blobdiff - drivers/staging/rtl8712/usb_intf.c
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[~andy/linux] / drivers / staging / rtl8712 / usb_intf.c
index 9bade184883bdd28a32bbe8f1e21fe365ef09993..9bd18e2d05130dcbab81c55cd4853c68521870bf 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <linux/usb.h>
 #include <linux/module.h>
+#include <linux/firmware.h>
 
 #include "osdep_service.h"
 #include "drv_types.h"
@@ -105,10 +106,10 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
 /* RTL8191SU */
        /* Realtek */
        {USB_DEVICE(0x0BDA, 0x8172)},
+       {USB_DEVICE(0x0BDA, 0x8192)},
        /* Amigo */
        {USB_DEVICE(0x0EB0, 0x9061)},
        /* ASUS/EKB */
-       {USB_DEVICE(0x0BDA, 0x8172)},
        {USB_DEVICE(0x13D3, 0x3323)},
        {USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */
        {USB_DEVICE(0x13D3, 0x3342)},
@@ -160,7 +161,6 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
 /* RTL8192SU */
        /* Realtek */
        {USB_DEVICE(0x0BDA, 0x8174)},
-       {USB_DEVICE(0x0BDA, 0x8174)},
        /* Belkin */
        {USB_DEVICE(0x050D, 0x845A)},
        /* Corega */
@@ -281,7 +281,6 @@ static uint r8712_usb_dvobj_init(struct _adapter *padapter)
        }
        if ((r8712_alloc_io_queue(padapter)) == _FAIL)
                status = _FAIL;
-       sema_init(&(padapter->dvobjpriv.usb_suspend_sema), 0);
        return status;
 }
 
@@ -622,26 +621,28 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
        struct usb_device *udev = interface_to_usbdev(pusb_intf);
 
        usb_set_intfdata(pusb_intf, NULL);
-       if (padapter) {
-               if (drvpriv.drv_registered == true)
-                       padapter->bSurpriseRemoved = true;
-               if (pnetdev != NULL) {
-                       /* will call netdev_close() */
-                       unregister_netdev(pnetdev);
-               }
-               flush_scheduled_work();
-               udelay(1);
-               /*Stop driver mlme relation timer */
-               if (padapter->fw_found)
-                       r8712_stop_drv_timers(padapter);
-               r871x_dev_unload(padapter);
-               r8712_free_drv_sw(padapter);
+       if (padapter->fw_found)
+               release_firmware(padapter->fw);
+       /* never exit with a firmware callback pending */
+       wait_for_completion(&padapter->rtl8712_fw_ready);
+       if (drvpriv.drv_registered == true)
+               padapter->bSurpriseRemoved = true;
+       if (pnetdev != NULL) {
+               /* will call netdev_close() */
+               unregister_netdev(pnetdev);
        }
+       flush_scheduled_work();
+       udelay(1);
+       /*Stop driver mlme relation timer */
+       if (padapter->fw_found)
+               r8712_stop_drv_timers(padapter);
+       r871x_dev_unload(padapter);
+       r8712_free_drv_sw(padapter);
        usb_set_intfdata(pusb_intf, NULL);
        /* decrease the reference count of the usb device structure
         * when disconnect */
        usb_put_dev(udev);
-       /* If we didn't unplug usb dongle and remove/insert modlue, driver
+       /* If we didn't unplug usb dongle and remove/insert module, driver
         * fails on sitesurvey for the first time when device is up.
         * Reset usb port for sitesurvey fail issue. */
        if (udev->state != USB_STATE_NOTATTACHED)