diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-11-30 06:17:12 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-11-30 06:17:12 -0500 |
commit | a780efa8124fe7ef23d8ef844d56afe960356615 (patch) | |
tree | e63fddda9b991d1507890e57865d325912797d67 /drivers/bluetooth/btusb.c | |
parent | 2eda66f4a0b9803c6a85d5e5ccd8e802bd23b998 (diff) |
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: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btusb.c')
-rw-r--r-- | drivers/bluetooth/btusb.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3c85f9b078b5..9ca95208fc24 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -680,8 +680,19 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt) | |||
680 | 680 | ||
681 | BT_DBG("%s evt %d", hdev->name, evt); | 681 | BT_DBG("%s evt %d", hdev->name, evt); |
682 | 682 | ||
683 | if (evt == HCI_NOTIFY_CONN_ADD || evt == HCI_NOTIFY_CONN_DEL) | 683 | if (hdev->conn_hash.acl_num > 0) { |
684 | schedule_work(&data->work); | 684 | if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { |
685 | if (btusb_submit_bulk_urb(hdev, GFP_ATOMIC) < 0) | ||
686 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
687 | else | ||
688 | btusb_submit_bulk_urb(hdev, GFP_ATOMIC); | ||
689 | } | ||
690 | } else { | ||
691 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
692 | usb_unlink_anchored_urbs(&data->bulk_anchor); | ||
693 | } | ||
694 | |||
695 | schedule_work(&data->work); | ||
685 | } | 696 | } |
686 | 697 | ||
687 | static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting) | 698 | 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 | struct btusb_data *data = container_of(work, struct btusb_data, work); | 743 | struct btusb_data *data = container_of(work, struct btusb_data, work); |
733 | struct hci_dev *hdev = data->hdev; | 744 | struct hci_dev *hdev = data->hdev; |
734 | 745 | ||
735 | if (hdev->conn_hash.acl_num > 0) { | ||
736 | if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { | ||
737 | if (btusb_submit_bulk_urb(hdev, GFP_KERNEL) < 0) | ||
738 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
739 | else | ||
740 | btusb_submit_bulk_urb(hdev, GFP_KERNEL); | ||
741 | } | ||
742 | } else { | ||
743 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
744 | usb_kill_anchored_urbs(&data->bulk_anchor); | ||
745 | } | ||
746 | |||
747 | if (hdev->conn_hash.sco_num > 0) { | 746 | if (hdev->conn_hash.sco_num > 0) { |
748 | if (data->isoc_altsetting != 2) { | 747 | if (data->isoc_altsetting != 2) { |
749 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 748 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |