diff options
-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); |