These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / hid / usbhid / hid-core.c
index eab5bd6..5dd426f 100644 (file)
@@ -477,8 +477,6 @@ static void hid_ctrl(struct urb *urb)
        struct usbhid_device *usbhid = hid->driver_data;
        int unplug = 0, status = urb->status;
 
-       spin_lock(&usbhid->lock);
-
        switch (status) {
        case 0:                 /* success */
                if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN)
@@ -498,6 +496,8 @@ static void hid_ctrl(struct urb *urb)
                hid_warn(urb->dev, "ctrl urb status %d received\n", status);
        }
 
+       spin_lock(&usbhid->lock);
+
        if (unplug) {
                usbhid->ctrltail = usbhid->ctrlhead;
        } else {
@@ -710,7 +710,8 @@ int usbhid_open(struct hid_device *hid)
                 * Wait 50 msec for the queue to empty before allowing events
                 * to go through hid.
                 */
-               msleep(50);
+               if (res == 0 && !(hid->quirks & HID_QUIRK_ALWAYS_POLL))
+                       msleep(50);
                clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
        }
 done: