Revert "HID: core: Provide new max_buffer_size attribute to over-ride the default"
This reverts commit 9bc878756b
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: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -258,7 +258,6 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
|
|||||||
{
|
{
|
||||||
struct hid_report *report;
|
struct hid_report *report;
|
||||||
struct hid_field *field;
|
struct hid_field *field;
|
||||||
unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE;
|
|
||||||
unsigned int usages;
|
unsigned int usages;
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -289,11 +288,8 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
|
|||||||
offset = report->size;
|
offset = report->size;
|
||||||
report->size += parser->global.report_size * parser->global.report_count;
|
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 */
|
/* 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");
|
hid_err(parser->device, "report is too long\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1756,7 +1752,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_enum *report_enum = hid->report_enum + type;
|
||||||
struct hid_report *report;
|
struct hid_report *report;
|
||||||
struct hid_driver *hdrv;
|
struct hid_driver *hdrv;
|
||||||
int max_buffer_size = HID_MAX_BUFFER_SIZE;
|
|
||||||
unsigned int a;
|
unsigned int a;
|
||||||
u32 rsize, csize = size;
|
u32 rsize, csize = size;
|
||||||
u8 *cdata = data;
|
u8 *cdata = data;
|
||||||
@@ -1773,13 +1768,10 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
|
|||||||
|
|
||||||
rsize = hid_compute_report_size(report);
|
rsize = hid_compute_report_size(report);
|
||||||
|
|
||||||
if (hid->ll_driver->max_buffer_size)
|
if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE)
|
||||||
max_buffer_size = hid->ll_driver->max_buffer_size;
|
rsize = HID_MAX_BUFFER_SIZE - 1;
|
||||||
|
else if (rsize > HID_MAX_BUFFER_SIZE)
|
||||||
if (report_enum->numbered && rsize >= max_buffer_size)
|
rsize = HID_MAX_BUFFER_SIZE;
|
||||||
rsize = max_buffer_size - 1;
|
|
||||||
else if (rsize > max_buffer_size)
|
|
||||||
rsize = max_buffer_size;
|
|
||||||
|
|
||||||
if (csize < rsize) {
|
if (csize < rsize) {
|
||||||
dbg_hid("report %d is too short, (%d < %d)\n", report->id,
|
dbg_hid("report %d is too short, (%d < %d)\n", report->id,
|
||||||
|
@@ -798,7 +798,6 @@ struct hid_driver {
|
|||||||
* @raw_request: send raw report request to device (e.g. feature report)
|
* @raw_request: send raw report request to device (e.g. feature report)
|
||||||
* @output_report: send output report to device
|
* @output_report: send output report to device
|
||||||
* @idle: send idle request 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 {
|
struct hid_ll_driver {
|
||||||
int (*start)(struct hid_device *hdev);
|
int (*start)(struct hid_device *hdev);
|
||||||
@@ -823,8 +822,6 @@ struct hid_ll_driver {
|
|||||||
int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
|
int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
|
||||||
|
|
||||||
int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
|
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;
|
extern struct hid_ll_driver i2c_hid_ll_driver;
|
||||||
|
Reference in New Issue
Block a user