提交 aef3156d 编写于 作者: J Jason Gerecke 提交者: Jiri Kosina

HID: wacom: Have wacom_{get,set}_report retry on -EAGAIN, not -EPIPE

Retrying on -EPIPE makes very little sense since this typically indicates
a problem that will not just disappear on its own. For instance, the USB
documentation states that it will be sent if the endpoint is stalled or
the device has disconnected. Instead, we should retry if -EAGAIN is
received since this indicates a temporary error condition such as a busy
bus.

In addition to adjusting the conditions we retry under, we also log an
error on failure so that we can be aware of what's going on.
Signed-off-by: NJason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 8e116d31
...@@ -35,7 +35,11 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf, ...@@ -35,7 +35,11 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf,
do { do {
retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, retval = hid_hw_raw_request(hdev, buf[0], buf, size, type,
HID_REQ_GET_REPORT); HID_REQ_GET_REPORT);
} while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); } while ((retval == -ETIMEDOUT || retval == -EAGAIN) && --retries);
if (retval < 0)
hid_err(hdev, "wacom_get_report: ran out of retries "
"(last error = %d)\n", retval);
return retval; return retval;
} }
...@@ -48,7 +52,11 @@ static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, ...@@ -48,7 +52,11 @@ static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf,
do { do {
retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, retval = hid_hw_raw_request(hdev, buf[0], buf, size, type,
HID_REQ_SET_REPORT); HID_REQ_SET_REPORT);
} while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); } while ((retval == -ETIMEDOUT || retval == -EAGAIN) && --retries);
if (retval < 0)
hid_err(hdev, "wacom_set_report: ran out of retries "
"(last error = %d)\n", retval);
return retval; return retval;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册