Commit 296b7378 authored by Przemo Firszt's avatar Przemo Firszt Committed by Dmitry Torokhov

Input: wacom - remove passing id for wacom_set_report

Every call of wacom_set_report was passing "id" as a separate parameter
and buffer also passed the same information. We can use first u8 of the
buffer instead of "id"
Signed-off-by: default avatarPrzemo Firszt <przemo@firszt.eu>
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: default avatarPing Cheng <pingc@wacom.com>
Tested-by: default avatarPrzemo Firszt <przemo@firszt.eu>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 849e2f06
...@@ -36,13 +36,13 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, ...@@ -36,13 +36,13 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id,
return retval; return retval;
} }
static int wacom_set_report(struct hid_device *hdev, u8 type, u8 id, static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf,
void *buf, size_t size, unsigned int retries) size_t size, unsigned int retries)
{ {
int retval; int retval;
do { do {
retval = hid_hw_raw_request(hdev, id, 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 == -EPIPE) && --retries);
...@@ -251,8 +251,8 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id, ...@@ -251,8 +251,8 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id,
rep_data[0] = report_id; rep_data[0] = report_id;
rep_data[1] = mode; rep_data[1] = mode;
error = wacom_set_report(hdev, HID_FEATURE_REPORT, error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data,
report_id, rep_data, length, 1); length, 1);
if (error >= 0) if (error >= 0)
error = wacom_get_report(hdev, HID_FEATURE_REPORT, error = wacom_get_report(hdev, HID_FEATURE_REPORT,
report_id, rep_data, length, 1); report_id, rep_data, length, 1);
...@@ -274,15 +274,15 @@ static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed, ...@@ -274,15 +274,15 @@ static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed,
case GRAPHIRE_BT: case GRAPHIRE_BT:
rep_data[0] = 0x03; rep_data[0] = 0x03;
rep_data[1] = 0x00; rep_data[1] = 0x00;
ret = wacom_set_report(hdev, HID_FEATURE_REPORT, ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2,
rep_data[0], rep_data, 2, 3); 3);
if (ret >= 0) { if (ret >= 0) {
rep_data[0] = speed == 0 ? 0x05 : 0x06; rep_data[0] = speed == 0 ? 0x05 : 0x06;
rep_data[1] = 0x00; rep_data[1] = 0x00;
ret = wacom_set_report(hdev, HID_FEATURE_REPORT, ret = wacom_set_report(hdev, HID_FEATURE_REPORT,
rep_data[0], rep_data, 2, 3); rep_data, 2, 3);
if (ret >= 0) { if (ret >= 0) {
wacom->wacom_wac.bt_high_speed = speed; wacom->wacom_wac.bt_high_speed = speed;
...@@ -306,8 +306,8 @@ static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed, ...@@ -306,8 +306,8 @@ static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed,
rep_data[0] = 0x03; rep_data[0] = 0x03;
rep_data[1] = wacom->wacom_wac.bt_features; rep_data[1] = wacom->wacom_wac.bt_features;
ret = wacom_set_report(hdev, HID_FEATURE_REPORT, ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2,
rep_data[0], rep_data, 2, 1); 1);
if (ret >= 0) if (ret >= 0)
wacom->wacom_wac.bt_high_speed = speed; wacom->wacom_wac.bt_high_speed = speed;
break; break;
...@@ -520,8 +520,8 @@ static int wacom_led_control(struct wacom *wacom) ...@@ -520,8 +520,8 @@ static int wacom_led_control(struct wacom *wacom)
buf[4] = wacom->led.img_lum; buf[4] = wacom->led.img_lum;
} }
retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 9,
WAC_CMD_LED_CONTROL, buf, 9, WAC_CMD_RETRIES); WAC_CMD_RETRIES);
kfree(buf); kfree(buf);
return retval; return retval;
...@@ -541,8 +541,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, ...@@ -541,8 +541,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id,
/* Send 'start' command */ /* Send 'start' command */
buf[0] = WAC_CMD_ICON_START; buf[0] = WAC_CMD_ICON_START;
buf[1] = 1; buf[1] = 1;
retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2,
WAC_CMD_ICON_START, buf, 2, WAC_CMD_RETRIES); WAC_CMD_RETRIES);
if (retval < 0) if (retval < 0)
goto out; goto out;
...@@ -553,8 +553,7 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, ...@@ -553,8 +553,7 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id,
memcpy(buf + 3, img + i * chunk_len, chunk_len); memcpy(buf + 3, img + i * chunk_len, chunk_len);
retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT,
xfer_id, buf, chunk_len + 3, buf, chunk_len + 3, WAC_CMD_RETRIES);
WAC_CMD_RETRIES);
if (retval < 0) if (retval < 0)
break; break;
} }
...@@ -562,8 +561,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, ...@@ -562,8 +561,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id,
/* Send 'stop' */ /* Send 'stop' */
buf[0] = WAC_CMD_ICON_START; buf[0] = WAC_CMD_ICON_START;
buf[1] = 0; buf[1] = 0;
wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, WAC_CMD_ICON_START, wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2,
buf, 2, WAC_CMD_RETRIES); WAC_CMD_RETRIES);
out: out:
kfree(buf); kfree(buf);
......
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