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

Commit b94e3c94 authored by Matthieu CASTET's avatar Matthieu CASTET Committed by Jiri Kosina
Browse files

HID: hid-core: optimize in case of hidraw



When using hidraw, hid buffer can be big and take lot's of
time to process (interrupt) kernel context.
Don't try to parse report if we are only interrested in hidraw.

Also don't prepare data for debug stuff if no debugfs file
are opened.

Signed-off-by: default avatarMatthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 4c7b417e
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -1194,8 +1194,10 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
			goto out;
			goto out;
	}
	}


	if (hid->claimed != HID_CLAIMED_HIDRAW) {
		for (a = 0; a < report->maxfield; a++)
		for (a = 0; a < report->maxfield; a++)
			hid_input_field(hid, report->field[a], cdata, interrupt);
			hid_input_field(hid, report->field[a], cdata, interrupt);
	}


	if (hid->claimed & HID_CLAIMED_INPUT)
	if (hid->claimed & HID_CLAIMED_INPUT)
		hidinput_report_event(hid, report);
		hidinput_report_event(hid, report);
@@ -1243,6 +1245,10 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
		goto unlock;
		goto unlock;
	}
	}


	/* Avoid unnecessary overhead if debugfs is disabled */
	if (list_empty(&hid->debug_list))
		goto nomem;

	buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);
	buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);


	if (!buf)
	if (!buf)
+1 −1
Original line number Original line Diff line number Diff line
@@ -1846,7 +1846,7 @@ static void picolcd_debug_out_report(struct picolcd_data *data,
#define BUFF_SZ 256
#define BUFF_SZ 256


	/* Avoid unnecessary overhead if debugfs is disabled */
	/* Avoid unnecessary overhead if debugfs is disabled */
	if (!hdev->debug_events)
	if (list_empty(&hdev->debug_list))
		return;
		return;


	buff = kmalloc(BUFF_SZ, GFP_ATOMIC);
	buff = kmalloc(BUFF_SZ, GFP_ATOMIC);