Skip to content

Commit

Permalink
[Bluetooth] Fix USB disconnect handling of btusb driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcel Holtmann committed Sep 22, 2008
1 parent e8c3c3d commit 5fbcd26
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 5fbcd26

Please sign in to comment.