Commit a780efa8 authored by Marcel Holtmann's avatar Marcel Holtmann

Bluetooth: Handle bulk URBs in btusb driver from notify callback

With the addition of usb_unlink_anchored_urbs() it is possible to fully
control the bulk URBs from the notify callback. There is no need to
schedule work and so only do this for the ISOC URBs.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 2eda66f4
...@@ -680,8 +680,19 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt) ...@@ -680,8 +680,19 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
BT_DBG("%s evt %d", hdev->name, evt); BT_DBG("%s evt %d", hdev->name, evt);
if (evt == HCI_NOTIFY_CONN_ADD || evt == HCI_NOTIFY_CONN_DEL) if (hdev->conn_hash.acl_num > 0) {
schedule_work(&data->work); if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) {
if (btusb_submit_bulk_urb(hdev, GFP_ATOMIC) < 0)
clear_bit(BTUSB_BULK_RUNNING, &data->flags);
else
btusb_submit_bulk_urb(hdev, GFP_ATOMIC);
}
} else {
clear_bit(BTUSB_BULK_RUNNING, &data->flags);
usb_unlink_anchored_urbs(&data->bulk_anchor);
}
schedule_work(&data->work);
} }
static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting) static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting)
...@@ -732,18 +743,6 @@ static void btusb_work(struct work_struct *work) ...@@ -732,18 +743,6 @@ static void btusb_work(struct work_struct *work)
struct btusb_data *data = container_of(work, struct btusb_data, work); struct btusb_data *data = container_of(work, struct btusb_data, work);
struct hci_dev *hdev = data->hdev; struct hci_dev *hdev = data->hdev;
if (hdev->conn_hash.acl_num > 0) {
if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) {
if (btusb_submit_bulk_urb(hdev, GFP_KERNEL) < 0)
clear_bit(BTUSB_BULK_RUNNING, &data->flags);
else
btusb_submit_bulk_urb(hdev, GFP_KERNEL);
}
} else {
clear_bit(BTUSB_BULK_RUNNING, &data->flags);
usb_kill_anchored_urbs(&data->bulk_anchor);
}
if (hdev->conn_hash.sco_num > 0) { if (hdev->conn_hash.sco_num > 0) {
if (data->isoc_altsetting != 2) { if (data->isoc_altsetting != 2) {
clear_bit(BTUSB_ISOC_RUNNING, &data->flags); clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment