]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
[Bluetooth] Fix USB disconnect handling of btusb driver
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 22 Sep 2008 22:16:36 +0000 (00:16 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 22 Sep 2008 22:16:36 +0000 (00:16 +0200)
The USB transport specification for Bluetooth splits the ACL and SCO
handling into two separate interfaces. In Linux it possible to probe
and disconnect these interfaces independently. So make sure that both
interfaces are tightly bound together.

This fixes the suspend regression that some people have expierenced.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btusb.c

index b4756a6a3a6867ccaa6968995c68fe4b3df6fdf5..29ae99817c60a58b0c15ce85a13bf98c3cbdd79a 100644 (file)
@@ -172,6 +172,7 @@ static struct usb_device_id blacklist_table[] = {
 struct btusb_data {
        struct hci_dev       *hdev;
        struct usb_device    *udev;
+       struct usb_interface *intf;
        struct usb_interface *isoc;
 
        spinlock_t lock;
@@ -826,6 +827,7 @@ static int btusb_probe(struct usb_interface *intf,
        }
 
        data->udev = interface_to_usbdev(intf);
+       data->intf = intf;
 
        spin_lock_init(&data->lock);
 
@@ -894,7 +896,7 @@ static int btusb_probe(struct usb_interface *intf,
 
        if (data->isoc) {
                err = usb_driver_claim_interface(&btusb_driver,
-                                                       data->isoc, NULL);
+                                                       data->isoc, data);
                if (err < 0) {
                        hci_free_dev(hdev);
                        kfree(data);
@@ -926,13 +928,22 @@ static void btusb_disconnect(struct usb_interface *intf)
 
        hdev = data->hdev;
 
-       if (data->isoc)
-               usb_driver_release_interface(&btusb_driver, data->isoc);
+       __hci_dev_hold(hdev);
 
-       usb_set_intfdata(intf, NULL);
+       usb_set_intfdata(data->intf, NULL);
+
+       if (data->isoc)
+               usb_set_intfdata(data->isoc, NULL);
 
        hci_unregister_dev(hdev);
 
+       if (intf == data->isoc)
+               usb_driver_release_interface(&btusb_driver, data->intf);
+       else if (data->isoc)
+               usb_driver_release_interface(&btusb_driver, data->isoc);
+
+       __hci_dev_put(hdev);
+
        hci_free_dev(hdev);
 }