Skip to contentSkip to conversation

HID: wacom: Do not repeatedly attempt to set device mode on error

PATCH Applied Jason Gerecke 2 participants 2 messages Aug 5, 2015 – Aug 10, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: wacom: Do not repeatedly attempt to set device mode on error

As an extension of aef3156d7, there is no sense in repeatedly calling the 'wacom_set_report' and 'wacom_get_report' functions if they return an error. Getting an error from them implies that the device is out to lunch:
either a hard error code was returned or repeated attempts at recovering from a "soft" error all failed. In either case, doing even more retries is not likely to resolve whatever is wrong.

---
 drivers/hid/wacom_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/wacom_sys.c +1 -1
index 20d15c5..6edb7d1 100644
@@ -335,7 +335,7 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id,
 		if (error >= 0)
 			error = wacom_get_report(hdev, HID_FEATURE_REPORT,
 			                         rep_data, length, 1);
-	} while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES);
+	} while (error >= 0 && rep_data[1] != mode && limit++ < WAC_MSG_RETRIES);
 
 	kfree(rep_data);
 
Signature · 1 line
2.5.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Jason Gerecke

As an extension of aef3156d7, there is no sense in repeatedly calling the 'wacom_set_report' and 'wacom_get_report' functions if they return an error. Getting an error from them implies that the device is out to lunch:
either a hard error code was returned or repeated attempts at recovering from a "soft" error all failed. In either case, doing even more retries is not likely to resolve whatever is wrong.

Applied to for-4.3/upstream.

Signature · 2 lines
Jiri Kosina
SUSE Labs