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

Commit 5fd4376e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "HID: core: Provide new max_buffer_size attribute to over-ride the default"



This reverts commit b687ac70 which is
commit b1a37ed00d7908a991c1d0f18a8cba3c2aa99bdc upstream.

It breaks the Android KABI and if needed, should come back in an
abi-safe way.

Bug: 161946584
Cc: Lee Jones <joneslee@google.com>
Change-Id: I1f160797720e8bdf4960542e711fd17940a975d9
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 6efc429d
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -258,7 +258,6 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
{
	struct hid_report *report;
	struct hid_field *field;
	unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE;
	unsigned int usages;
	unsigned int offset;
	unsigned int i;
@@ -289,11 +288,8 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
	offset = report->size;
	report->size += parser->global.report_size * parser->global.report_count;

	if (parser->device->ll_driver->max_buffer_size)
		max_buffer_size = parser->device->ll_driver->max_buffer_size;

	/* Total size check: Allow for possible report index byte */
	if (report->size > (max_buffer_size - 1) << 3) {
	if (report->size > (HID_MAX_BUFFER_SIZE - 1) << 3) {
		hid_err(parser->device, "report is too long\n");
		return -1;
	}
@@ -1749,7 +1745,6 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
	struct hid_report_enum *report_enum = hid->report_enum + type;
	struct hid_report *report;
	struct hid_driver *hdrv;
	int max_buffer_size = HID_MAX_BUFFER_SIZE;
	unsigned int a;
	u32 rsize, csize = size;
	u8 *cdata = data;
@@ -1766,13 +1761,10 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,

	rsize = hid_compute_report_size(report);

	if (hid->ll_driver->max_buffer_size)
		max_buffer_size = hid->ll_driver->max_buffer_size;

	if (report_enum->numbered && rsize >= max_buffer_size)
		rsize = max_buffer_size - 1;
	else if (rsize > max_buffer_size)
		rsize = max_buffer_size;
	if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE)
		rsize = HID_MAX_BUFFER_SIZE - 1;
	else if (rsize > HID_MAX_BUFFER_SIZE)
		rsize = HID_MAX_BUFFER_SIZE;

	if (csize < rsize) {
		dbg_hid("report %d is too short, (%d < %d)\n", report->id,
+0 −3
Original line number Diff line number Diff line
@@ -802,7 +802,6 @@ struct hid_driver {
 * @raw_request: send raw report request to device (e.g. feature report)
 * @output_report: send output report to device
 * @idle: send idle request to device
 * @max_buffer_size: over-ride maximum data buffer size (default: HID_MAX_BUFFER_SIZE)
 */
struct hid_ll_driver {
	int (*start)(struct hid_device *hdev);
@@ -827,8 +826,6 @@ struct hid_ll_driver {
	int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);

	int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);

	unsigned int max_buffer_size;
};

extern struct hid_ll_driver i2c_hid_ll_driver;