Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122415
b: refs/heads/master
c: 6a88adf
h: refs/heads/master
i:
  122413: 885a7ec
  122411: c80ff32
  122407: 8b68b19
  122399: 23c11ed
v: v3
  • Loading branch information
Marcel Holtmann committed Nov 30, 2008
1 parent f6986a1 commit dcd5408
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a780efa8124fe7ef23d8ef844d56afe960356615
refs/heads/master: 6a88adf2adf5d6a3b759c2e114da4c5266ca3972
62 changes: 62 additions & 0 deletions trunk/drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ struct btusb_data {
struct usb_endpoint_descriptor *isoc_rx_ep;

int isoc_altsetting;
int suspend_count;
};

static void btusb_intr_complete(struct urb *urb)
Expand Down Expand Up @@ -948,10 +949,71 @@ static void btusb_disconnect(struct usb_interface *intf)
hci_free_dev(hdev);
}

static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
{
struct btusb_data *data = usb_get_intfdata(intf);

BT_DBG("intf %p", intf);

if (data->suspend_count++)
return 0;

cancel_work_sync(&data->work);

usb_kill_anchored_urbs(&data->tx_anchor);

usb_kill_anchored_urbs(&data->isoc_anchor);
usb_kill_anchored_urbs(&data->bulk_anchor);
usb_kill_anchored_urbs(&data->intr_anchor);

return 0;
}

static int btusb_resume(struct usb_interface *intf)
{
struct btusb_data *data = usb_get_intfdata(intf);
struct hci_dev *hdev = data->hdev;
int err;

BT_DBG("intf %p", intf);

if (--data->suspend_count)
return 0;

if (!test_bit(HCI_RUNNING, &hdev->flags))
return 0;

if (test_bit(BTUSB_INTR_RUNNING, &data->flags)) {
err = btusb_submit_intr_urb(hdev, GFP_NOIO);
if (err < 0) {
clear_bit(BTUSB_INTR_RUNNING, &data->flags);
return err;
}
}

if (test_bit(BTUSB_BULK_RUNNING, &data->flags)) {
if (btusb_submit_bulk_urb(hdev, GFP_NOIO) < 0)
clear_bit(BTUSB_BULK_RUNNING, &data->flags);
else
btusb_submit_bulk_urb(hdev, GFP_NOIO);
}

if (test_bit(BTUSB_ISOC_RUNNING, &data->flags)) {
if (btusb_submit_isoc_urb(hdev, GFP_NOIO) < 0)
clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
else
btusb_submit_isoc_urb(hdev, GFP_NOIO);
}

return 0;
}

static struct usb_driver btusb_driver = {
.name = "btusb",
.probe = btusb_probe,
.disconnect = btusb_disconnect,
.suspend = btusb_suspend,
.resume = btusb_resume,
.id_table = btusb_table,
};

Expand Down

0 comments on commit dcd5408

Please sign in to comment.