diff options
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 4 | ||||
-rw-r--r-- | include/linux/hid.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index f6a5d8930348..e0d805f1b2bf 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -82,6 +82,7 @@ static int hid_start_in(struct hid_device *hid) | |||
82 | 82 | ||
83 | spin_lock_irqsave(&usbhid->inlock, flags); | 83 | spin_lock_irqsave(&usbhid->inlock, flags); |
84 | if (hid->open > 0 && !test_bit(HID_SUSPENDED, &usbhid->iofl) && | 84 | if (hid->open > 0 && !test_bit(HID_SUSPENDED, &usbhid->iofl) && |
85 | !test_bit(HID_DISCONNECTED, &usbhid->iofl) && | ||
85 | !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) { | 86 | !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) { |
86 | rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC); | 87 | rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC); |
87 | if (rc != 0) | 88 | if (rc != 0) |
@@ -155,7 +156,7 @@ static void hid_io_error(struct hid_device *hid) | |||
155 | spin_lock_irqsave(&usbhid->inlock, flags); | 156 | spin_lock_irqsave(&usbhid->inlock, flags); |
156 | 157 | ||
157 | /* Stop when disconnected */ | 158 | /* Stop when disconnected */ |
158 | if (usb_get_intfdata(usbhid->intf) == NULL) | 159 | if (test_bit(HID_DISCONNECTED, &usbhid->iofl)) |
159 | goto done; | 160 | goto done; |
160 | 161 | ||
161 | /* If it has been a while since the last error, we'll assume | 162 | /* If it has been a while since the last error, we'll assume |
@@ -941,6 +942,7 @@ static void hid_disconnect(struct usb_interface *intf) | |||
941 | 942 | ||
942 | spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ | 943 | spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ |
943 | usb_set_intfdata(intf, NULL); | 944 | usb_set_intfdata(intf, NULL); |
945 | set_bit(HID_DISCONNECTED, &usbhid->iofl); | ||
944 | spin_unlock_irq(&usbhid->inlock); | 946 | spin_unlock_irq(&usbhid->inlock); |
945 | usb_kill_urb(usbhid->urbin); | 947 | usb_kill_urb(usbhid->urbin); |
946 | usb_kill_urb(usbhid->urbout); | 948 | usb_kill_urb(usbhid->urbout); |
diff --git a/include/linux/hid.h b/include/linux/hid.h index fe4ac31eced2..d951ec411241 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -424,6 +424,7 @@ struct hid_control_fifo { | |||
424 | #define HID_RESET_PENDING 4 | 424 | #define HID_RESET_PENDING 4 |
425 | #define HID_SUSPENDED 5 | 425 | #define HID_SUSPENDED 5 |
426 | #define HID_CLEAR_HALT 6 | 426 | #define HID_CLEAR_HALT 6 |
427 | #define HID_DISCONNECTED 7 | ||
427 | 428 | ||
428 | struct hid_input { | 429 | struct hid_input { |
429 | struct list_head list; | 430 | struct list_head list; |