diff options
author | Przemo Firszt <przemo@firszt.eu> | 2014-08-06 17:00:38 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-08-06 18:14:53 -0400 |
commit | 296b737874b8a671a8f9ee5a64602f15c06ae937 (patch) | |
tree | 071f5bb0dc9618d40bf46bb833605c848d11bef0 /drivers/hid | |
parent | 849e2f06781a0c73573024bdaea0babc0c4e31af (diff) |
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: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Tested-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/wacom_sys.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index a12cd9c3a6ee..6e0c19146a79 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -36,13 +36,13 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, | |||
36 | return retval; | 36 | return retval; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int wacom_set_report(struct hid_device *hdev, u8 type, u8 id, | 39 | static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, |
40 | void *buf, size_t size, unsigned int retries) | 40 | size_t size, unsigned int retries) |
41 | { | 41 | { |
42 | int retval; | 42 | int retval; |
43 | 43 | ||
44 | do { | 44 | do { |
45 | retval = hid_hw_raw_request(hdev, id, buf, size, type, | 45 | retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, |
46 | HID_REQ_SET_REPORT); | 46 | HID_REQ_SET_REPORT); |
47 | } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); | 47 | } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); |
48 | 48 | ||
@@ -251,8 +251,8 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id, | |||
251 | rep_data[0] = report_id; | 251 | rep_data[0] = report_id; |
252 | rep_data[1] = mode; | 252 | rep_data[1] = mode; |
253 | 253 | ||
254 | error = wacom_set_report(hdev, HID_FEATURE_REPORT, | 254 | error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, |
255 | report_id, rep_data, length, 1); | 255 | length, 1); |
256 | if (error >= 0) | 256 | if (error >= 0) |
257 | error = wacom_get_report(hdev, HID_FEATURE_REPORT, | 257 | error = wacom_get_report(hdev, HID_FEATURE_REPORT, |
258 | report_id, rep_data, length, 1); | 258 | report_id, rep_data, length, 1); |
@@ -274,15 +274,15 @@ static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed, | |||
274 | case GRAPHIRE_BT: | 274 | case GRAPHIRE_BT: |
275 | rep_data[0] = 0x03; | 275 | rep_data[0] = 0x03; |
276 | rep_data[1] = 0x00; | 276 | rep_data[1] = 0x00; |
277 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, | 277 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, |
278 | rep_data[0], rep_data, 2, 3); | 278 | 3); |
279 | 279 | ||
280 | if (ret >= 0) { | 280 | if (ret >= 0) { |
281 | rep_data[0] = speed == 0 ? 0x05 : 0x06; | 281 | rep_data[0] = speed == 0 ? 0x05 : 0x06; |
282 | rep_data[1] = 0x00; | 282 | rep_data[1] = 0x00; |
283 | 283 | ||
284 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, | 284 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, |
285 | rep_data[0], rep_data, 2, 3); | 285 | rep_data, 2, 3); |
286 | 286 | ||
287 | if (ret >= 0) { | 287 | if (ret >= 0) { |
288 | wacom->wacom_wac.bt_high_speed = speed; | 288 | 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 | rep_data[0] = 0x03; | 306 | rep_data[0] = 0x03; |
307 | rep_data[1] = wacom->wacom_wac.bt_features; | 307 | rep_data[1] = wacom->wacom_wac.bt_features; |
308 | 308 | ||
309 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, | 309 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, |
310 | rep_data[0], rep_data, 2, 1); | 310 | 1); |
311 | if (ret >= 0) | 311 | if (ret >= 0) |
312 | wacom->wacom_wac.bt_high_speed = speed; | 312 | wacom->wacom_wac.bt_high_speed = speed; |
313 | break; | 313 | break; |
@@ -520,8 +520,8 @@ static int wacom_led_control(struct wacom *wacom) | |||
520 | buf[4] = wacom->led.img_lum; | 520 | buf[4] = wacom->led.img_lum; |
521 | } | 521 | } |
522 | 522 | ||
523 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, | 523 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 9, |
524 | WAC_CMD_LED_CONTROL, buf, 9, WAC_CMD_RETRIES); | 524 | WAC_CMD_RETRIES); |
525 | kfree(buf); | 525 | kfree(buf); |
526 | 526 | ||
527 | return retval; | 527 | return retval; |
@@ -541,8 +541,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, | |||
541 | /* Send 'start' command */ | 541 | /* Send 'start' command */ |
542 | buf[0] = WAC_CMD_ICON_START; | 542 | buf[0] = WAC_CMD_ICON_START; |
543 | buf[1] = 1; | 543 | buf[1] = 1; |
544 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, | 544 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, |
545 | WAC_CMD_ICON_START, buf, 2, WAC_CMD_RETRIES); | 545 | WAC_CMD_RETRIES); |
546 | if (retval < 0) | 546 | if (retval < 0) |
547 | goto out; | 547 | goto out; |
548 | 548 | ||
@@ -553,8 +553,7 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, | |||
553 | memcpy(buf + 3, img + i * chunk_len, chunk_len); | 553 | memcpy(buf + 3, img + i * chunk_len, chunk_len); |
554 | 554 | ||
555 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, | 555 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, |
556 | xfer_id, buf, chunk_len + 3, | 556 | buf, chunk_len + 3, WAC_CMD_RETRIES); |
557 | WAC_CMD_RETRIES); | ||
558 | if (retval < 0) | 557 | if (retval < 0) |
559 | break; | 558 | break; |
560 | } | 559 | } |
@@ -562,8 +561,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, | |||
562 | /* Send 'stop' */ | 561 | /* Send 'stop' */ |
563 | buf[0] = WAC_CMD_ICON_START; | 562 | buf[0] = WAC_CMD_ICON_START; |
564 | buf[1] = 0; | 563 | buf[1] = 0; |
565 | wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, WAC_CMD_ICON_START, | 564 | wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, |
566 | buf, 2, WAC_CMD_RETRIES); | 565 | WAC_CMD_RETRIES); |
567 | 566 | ||
568 | out: | 567 | out: |
569 | kfree(buf); | 568 | kfree(buf); |