Skip to content

Commit

Permalink
HID: replace hid_output_raw_report with hid_hw_raw_request for featur…
Browse files Browse the repository at this point in the history
…e requests

  ret = hid_output_raw_report(A, B, C, HID_FEATURE_REPORT);
is equivalent to
  ret = hid_hw_raw_request(A, B[0], B, C, HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
whatever the transport layer is.

So use the new API where available

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires authored and Jiri Kosina committed Feb 17, 2014
1 parent bd27e20 commit b0dd72a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
8 changes: 4 additions & 4 deletions drivers/hid/hid-lg.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,8 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) {
unsigned char buf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

ret = hid_output_raw_report(hdev, buf, sizeof(buf),
HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf),
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);

if (ret >= 0) {
/* insert a little delay of 10 jiffies ~ 40ms */
Expand All @@ -705,8 +705,8 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
buf[1] = 0xB2;
get_random_bytes(&buf[2], 2);

ret = hid_output_raw_report(hdev, buf, sizeof(buf),
HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf),
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
}
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-magicmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@ static int magicmouse_probe(struct hid_device *hdev,
* but there seems to be no other way of switching the mode.
* Thus the super-ugly hacky success check below.
*/
ret = hid_output_raw_report(hdev, feature, sizeof(feature),
HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, feature[0], feature, sizeof(feature),
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
if (ret != -EIO && ret != sizeof(feature)) {
hid_err(hdev, "unable to request touch data (%d)\n", ret);
goto err_stop_hw;
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-sony.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,8 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev)
static int sixaxis_set_operational_bt(struct hid_device *hdev)
{
unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
return hid_output_raw_report(hdev, buf, sizeof(buf),
HID_FEATURE_REPORT);
return hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf),
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
}

static void buzz_set_leds(struct hid_device *hdev, const __u8 *leds)
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/hid-thingm.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ static int blink1_send_command(struct blink1_data *data,
buf[0], buf[1], buf[2], buf[3], buf[4],
buf[5], buf[6], buf[7], buf[8]);

ret = hid_output_raw_report(data->hdev, buf, BLINK1_CMD_SIZE,
HID_FEATURE_REPORT);
ret = hid_hw_raw_request(data->hdev, buf[0], buf, BLINK1_CMD_SIZE,
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);

return ret < 0 ? ret : 0;
}
Expand Down
26 changes: 15 additions & 11 deletions drivers/hid/hid-wacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ static void wacom_set_image(struct hid_device *hdev, const char *image,

rep_data[0] = WAC_CMD_ICON_START_STOP;
rep_data[1] = 0;
ret = hid_output_raw_report(hdev, rep_data, 2, HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2,
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
if (ret < 0)
goto err;

Expand All @@ -142,14 +143,15 @@ static void wacom_set_image(struct hid_device *hdev, const char *image,
rep_data[j + 3] = p[(i << 6) + j];

rep_data[2] = i;
ret = hid_output_raw_report(hdev, rep_data, 67,
HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 67,
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
}

rep_data[0] = WAC_CMD_ICON_START_STOP;
rep_data[1] = 0;

ret = hid_output_raw_report(hdev, rep_data, 2, HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2,
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);

err:
return;
Expand Down Expand Up @@ -181,7 +183,8 @@ static void wacom_leds_set_brightness(struct led_classdev *led_dev,
buf[3] = value;
/* use fixed brightness for OLEDs */
buf[4] = 0x08;
hid_output_raw_report(hdev, buf, 9, HID_FEATURE_REPORT);
hid_hw_raw_request(hdev, buf[0], buf, 9, HID_FEATURE_REPORT,
HID_REQ_SET_REPORT);
kfree(buf);
}

Expand Down Expand Up @@ -337,8 +340,8 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
rep_data[0] = 0x03 ; rep_data[1] = 0x00;
limit = 3;
do {
ret = hid_output_raw_report(hdev, rep_data, 2,
HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2,
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
} while (ret < 0 && limit-- > 0);

if (ret >= 0) {
Expand All @@ -350,8 +353,9 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
rep_data[1] = 0x00;
limit = 3;
do {
ret = hid_output_raw_report(hdev,
rep_data, 2, HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, rep_data[0],
rep_data, 2, HID_FEATURE_REPORT,
HID_REQ_SET_REPORT);
} while (ret < 0 && limit-- > 0);

if (ret >= 0) {
Expand All @@ -376,8 +380,8 @@ static void wacom_set_features(struct hid_device *hdev, u8 speed)
rep_data[0] = 0x03;
rep_data[1] = wdata->features;

ret = hid_output_raw_report(hdev, rep_data, 2,
HID_FEATURE_REPORT);
ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2,
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
if (ret >= 0)
wdata->high_speed = speed;
break;
Expand Down

0 comments on commit b0dd72a

Please sign in to comment.