Commit a417ea44 authored by Ping Cheng's avatar Ping Cheng Committed by Dmitry Torokhov

Input: wacom - add WAC_MSG_RETRIES define

Use WAC_MSG_RETRIES define instead of a numeric constant.
Signed-off-by: default avatarPing Cheng <pingc@wacom.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 18adad1c
...@@ -49,6 +49,7 @@ struct hid_descriptor { ...@@ -49,6 +49,7 @@ struct hid_descriptor {
#define USB_REQ_GET_REPORT 0x01 #define USB_REQ_GET_REPORT 0x01
#define USB_REQ_SET_REPORT 0x09 #define USB_REQ_SET_REPORT 0x09
#define WAC_HID_FEATURE_REPORT 0x03 #define WAC_HID_FEATURE_REPORT 0x03
#define WAC_MSG_RETRIES 5
static int usb_get_report(struct usb_interface *intf, unsigned char type, static int usb_get_report(struct usb_interface *intf, unsigned char type,
unsigned char id, void *buf, int size) unsigned char id, void *buf, int size)
...@@ -165,7 +166,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi ...@@ -165,7 +166,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
report, report,
hid_desc->wDescriptorLength, hid_desc->wDescriptorLength,
5000); /* 5 secs */ 5000); /* 5 secs */
} while (result < 0 && limit++ < 5); } while (result < 0 && limit++ < WAC_MSG_RETRIES);
/* No need to parse the Descriptor. It isn't an error though */ /* No need to parse the Descriptor. It isn't an error though */
if (result < 0) if (result < 0)
...@@ -336,7 +337,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat ...@@ -336,7 +337,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
error = usb_get_report(intf, error = usb_get_report(intf,
WAC_HID_FEATURE_REPORT, report_id, WAC_HID_FEATURE_REPORT, report_id,
rep_data, 3); rep_data, 3);
} while ((error < 0 || rep_data[1] != 4) && limit++ < 5); } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
} else if (features->type != TABLETPC) { } else if (features->type != TABLETPC) {
do { do {
rep_data[0] = 2; rep_data[0] = 2;
...@@ -347,7 +348,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat ...@@ -347,7 +348,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
error = usb_get_report(intf, error = usb_get_report(intf,
WAC_HID_FEATURE_REPORT, report_id, WAC_HID_FEATURE_REPORT, report_id,
rep_data, 2); rep_data, 2);
} while ((error < 0 || rep_data[1] != 2) && limit++ < 5); } while ((error < 0 || rep_data[1] != 2) && limit++ < WAC_MSG_RETRIES);
} }
kfree(rep_data); kfree(rep_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment