Merge branch 'cleanups'
[cascardo/linux.git] / drivers / bluetooth / btusb.c
index 98341a4..b876888 100644 (file)
@@ -122,6 +122,10 @@ static const struct usb_device_id btusb_table[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01),
          .driver_info = BTUSB_BCM_PATCHRAM },
 
+       /* Lite-On Technology - Broadcom based */
+       { USB_VENDOR_AND_INTERFACE_INFO(0x04ca, 0xff, 0x01, 0x01),
+         .driver_info = BTUSB_BCM_PATCHRAM },
+
        /* Broadcom devices with vendor specific id */
        { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01),
          .driver_info = BTUSB_BCM_PATCHRAM },
@@ -1822,8 +1826,10 @@ static int btusb_recv_event_intel(struct hci_dev *hdev, struct sk_buff *skb)
                 */
                if (skb->len == 9 && hdr->evt == 0xff && hdr->plen == 0x07 &&
                    skb->data[2] == 0x02) {
-                       if (test_and_clear_bit(BTUSB_BOOTING, &data->flags))
-                               wake_up_interruptible(&hdev->req_wait_q);
+                       if (test_and_clear_bit(BTUSB_BOOTING, &data->flags)) {
+                               smp_mb__after_atomic();
+                               wake_up_bit(&data->flags, BTUSB_BOOTING);
+                       }
                }
        }
 
@@ -2236,33 +2242,25 @@ done:
 
        /* The bootloader will not indicate when the device is ready. This
         * is done by the operational firmware sending bootup notification.
+        *
+        * Booting into operational firmware should not take longer than
+        * 1 second. However if that happens, then just fail the setup
+        * since something went wrong.
         */
-       if (test_bit(BTUSB_BOOTING, &data->flags)) {
-               DECLARE_WAITQUEUE(wait, current);
-               signed long timeout;
-
-               BT_INFO("%s: Waiting for device to boot", hdev->name);
-
-               add_wait_queue(&hdev->req_wait_q, &wait);
-               set_current_state(TASK_INTERRUPTIBLE);
-
-               /* Booting into operational firmware should not take
-                * longer than 1 second. However if that happens, then
-                * just fail the setup since something went wrong.
-                */
-               timeout = schedule_timeout(msecs_to_jiffies(1000));
+       BT_INFO("%s: Waiting for device to boot", hdev->name);
 
-               remove_wait_queue(&hdev->req_wait_q, &wait);
+       err = btusb_wait_on_bit_timeout(&data->flags, BTUSB_BOOTING,
+                                       msecs_to_jiffies(1000),
+                                       TASK_INTERRUPTIBLE);
 
-               if (signal_pending(current)) {
-                       BT_ERR("%s: Device boot interrupted", hdev->name);
-                       return -EINTR;
-               }
+       if (err == 1) {
+               BT_ERR("%s: Device boot interrupted", hdev->name);
+               return -EINTR;
+       }
 
-               if (!timeout) {
-                       BT_ERR("%s: Device boot timeout", hdev->name);
-                       return -ETIMEDOUT;
-               }
+       if (err) {
+               BT_ERR("%s: Device boot timeout", hdev->name);
+               return -ETIMEDOUT;
        }
 
        rettime = ktime_get();
@@ -2711,6 +2709,7 @@ static int btusb_probe(struct usb_interface *intf,
        if (id->driver_info & BTUSB_INTEL) {
                hdev->setup = btusb_setup_intel;
                hdev->set_bdaddr = btusb_set_bdaddr_intel;
+               set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
        }
 
        if (id->driver_info & BTUSB_INTEL_NEW) {
@@ -2718,6 +2717,7 @@ static int btusb_probe(struct usb_interface *intf,
                hdev->setup = btusb_setup_intel_new;
                hdev->hw_error = btusb_hw_error_intel;
                hdev->set_bdaddr = btusb_set_bdaddr_intel;
+               set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
        }
 
        if (id->driver_info & BTUSB_MARVELL)