Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e845d46 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina
Browse files

HID: introduce helper to access hid_output_raw_report()



Add a helper to access hdev->hid_output_raw_report().

To convert the drivers, use the following snippets:

for i in drivers/hid/*.c
do
  sed -i.bak "s/[^ \t]*->hid_output_raw_report(/hid_output_raw_report(/g" $i
done

Then manually fix for checkpatch.pl

Reviewed-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent cafebc05
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1184,7 +1184,7 @@ static void hidinput_led_worker(struct work_struct *work)

	hid_output_report(report, buf);
	/* synchronous output report */
	hid->hid_output_raw_report(hid, buf, len, HID_OUTPUT_REPORT);
	hid_output_raw_report(hid, buf, len, HID_OUTPUT_REPORT);
	kfree(buf);
}

+4 −2
Original line number Diff line number Diff line
@@ -692,7 +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 = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
		ret = hid_output_raw_report(hdev, buf, sizeof(buf),
					    HID_FEATURE_REPORT);

		if (ret >= 0) {
			/* insert a little delay of 10 jiffies ~ 40ms */
@@ -704,7 +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 = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
			ret = hid_output_raw_report(hdev, buf, sizeof(buf),
						    HID_FEATURE_REPORT);
		}
	}

+1 −1
Original line number Diff line number Diff line
@@ -538,7 +538,7 @@ 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 = hdev->hid_output_raw_report(hdev, feature, sizeof(feature),
	ret = hid_output_raw_report(hdev, feature, sizeof(feature),
			HID_FEATURE_REPORT);
	if (ret != -EIO && ret != sizeof(feature)) {
		hid_err(hdev, "unable to request touch data (%d)\n", ret);
+3 −3
Original line number Diff line number Diff line
@@ -720,7 +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 hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
	return hid_output_raw_report(hdev, buf, sizeof(buf),
				     HID_FEATURE_REPORT);
}

static void buzz_set_leds(struct hid_device *hdev, const __u8 *leds)
@@ -942,8 +943,7 @@ static void sixaxis_state_worker(struct work_struct *work)
	buf[10] |= sc->led_state[2] << 3;
	buf[10] |= sc->led_state[3] << 4;

	sc->hdev->hid_output_raw_report(sc->hdev, buf, sizeof(buf),
					HID_OUTPUT_REPORT);
	hid_output_raw_report(sc->hdev, buf, sizeof(buf), HID_OUTPUT_REPORT);
}

static void dualshock4_state_worker(struct work_struct *work)
+2 −2
Original line number Diff line number Diff line
@@ -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 = data->hdev->hid_output_raw_report(data->hdev, buf,
			BLINK1_CMD_SIZE, HID_FEATURE_REPORT);
	ret = hid_output_raw_report(data->hdev, buf, BLINK1_CMD_SIZE,
				    HID_FEATURE_REPORT);

	return ret < 0 ? ret : 0;
}
Loading