diff options
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 79cf503e37bf..80c50763b3f8 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -116,40 +116,24 @@ static void hid_reset(struct work_struct *work) | |||
116 | struct usbhid_device *usbhid = | 116 | struct usbhid_device *usbhid = |
117 | container_of(work, struct usbhid_device, reset_work); | 117 | container_of(work, struct usbhid_device, reset_work); |
118 | struct hid_device *hid = usbhid->hid; | 118 | struct hid_device *hid = usbhid->hid; |
119 | int rc = 0; | 119 | int rc; |
120 | 120 | ||
121 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) { | 121 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) { |
122 | dev_dbg(&usbhid->intf->dev, "clear halt\n"); | 122 | dev_dbg(&usbhid->intf->dev, "clear halt\n"); |
123 | rc = usb_clear_halt(hid_to_usb_dev(hid), usbhid->urbin->pipe); | 123 | rc = usb_clear_halt(hid_to_usb_dev(hid), usbhid->urbin->pipe); |
124 | clear_bit(HID_CLEAR_HALT, &usbhid->iofl); | 124 | clear_bit(HID_CLEAR_HALT, &usbhid->iofl); |
125 | hid_start_in(hid); | ||
126 | } | ||
127 | |||
128 | else if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) { | ||
129 | dev_dbg(&usbhid->intf->dev, "resetting device\n"); | ||
130 | rc = usb_lock_device_for_reset(hid_to_usb_dev(hid), usbhid->intf); | ||
131 | if (rc == 0) { | 125 | if (rc == 0) { |
132 | rc = usb_reset_device(hid_to_usb_dev(hid)); | 126 | hid_start_in(hid); |
133 | usb_unlock_device(hid_to_usb_dev(hid)); | 127 | } else { |
128 | dev_dbg(&usbhid->intf->dev, | ||
129 | "clear-halt failed: %d\n", rc); | ||
130 | set_bit(HID_RESET_PENDING, &usbhid->iofl); | ||
134 | } | 131 | } |
135 | clear_bit(HID_RESET_PENDING, &usbhid->iofl); | ||
136 | } | 132 | } |
137 | 133 | ||
138 | switch (rc) { | 134 | if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) { |
139 | case 0: | 135 | dev_dbg(&usbhid->intf->dev, "resetting device\n"); |
140 | if (!test_bit(HID_IN_RUNNING, &usbhid->iofl)) | 136 | usb_queue_reset_device(usbhid->intf); |
141 | hid_io_error(hid); | ||
142 | break; | ||
143 | default: | ||
144 | hid_err(hid, "can't reset device, %s-%s/input%d, status %d\n", | ||
145 | hid_to_usb_dev(hid)->bus->bus_name, | ||
146 | hid_to_usb_dev(hid)->devpath, | ||
147 | usbhid->ifnum, rc); | ||
148 | /* FALLTHROUGH */ | ||
149 | case -EHOSTUNREACH: | ||
150 | case -ENODEV: | ||
151 | case -EINTR: | ||
152 | break; | ||
153 | } | 137 | } |
154 | } | 138 | } |
155 | 139 | ||