ath9k_htc: Really fix device hotunplug
authorSujith <Sujith.Manoharan@atheros.com>
Fri, 23 Apr 2010 04:58:20 +0000 (10:28 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 26 Apr 2010 18:21:22 +0000 (14:21 -0400)
All commands to the target are disabled when the device
is unplugged, but a normal module unload has to be
differentiated from this case, as we could still receive
data in the RX endpoint. Fix this by checking if the
device is attached or not.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/hif_usb.c

index 49b7a8970dddb0fc9e83b2662cfba190b22971ac..74872ca76f9a2c3a4cd679ac3fc4f120b6c7ce75 100644 (file)
@@ -922,7 +922,8 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
                (struct hif_device_usb *) usb_get_intfdata(interface);
 
        if (hif_dev) {
-               ath9k_htc_hw_deinit(hif_dev->htc_handle, true);
+               ath9k_htc_hw_deinit(hif_dev->htc_handle,
+                   (udev->state == USB_STATE_NOTATTACHED) ? true : false);
                ath9k_htc_hw_free(hif_dev->htc_handle);
                ath9k_hif_usb_dev_deinit(hif_dev);
                usb_set_intfdata(interface, NULL);