summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/hid.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-04-03 12:00:48 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2015-04-06 10:53:41 +0200
commit581baacd33b087e4f7322f42ca8f336f7f0acc4d (patch)
tree1c5790ed73644757e6e7fe4377484f802bffa507 /drivers/staging/greybus/hid.c
parent83a0cb593b5517a13f88c8f9ae9ce7e43af4b54b (diff)
greybus: hid: Use payload-size to get report size
Report size isn't passed as first two bytes of the report according to USB-HID spec. Get it from payload-size. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/hid.c')
-rw-r--r--drivers/staging/greybus/hid.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c
index 5935aa6c6334..556cf9b0fe93 100644
--- a/drivers/staging/greybus/hid.c
+++ b/drivers/staging/greybus/hid.c
@@ -155,7 +155,6 @@ static int gb_hid_irq_handler(u8 type, struct gb_operation *op)
struct gb_connection *connection = op->connection;
struct gb_hid *ghid = connection->private;
struct gb_hid_input_report_request *request = op->request->payload;
- int size;
if (type != GB_HID_TYPE_IRQ_EVENT) {
dev_err(&connection->dev,
@@ -163,24 +162,9 @@ static int gb_hid_irq_handler(u8 type, struct gb_operation *op)
return -EINVAL;
}
- if (op->request->payload_size < 2) {
- dev_err(&connection->dev, "short report received\n");
- return -EINVAL;
- }
-
- /*
- * FIXME: add report size to Greybus HID protocol if we need to parse
- * it here.
- */
- size = request->report[0] | request->report[1] << 8;
- if (size < 2 || size > op->request->payload_size - 2) {
- dev_err(&connection->dev, "bad report size: %d\n", size);
- return -EINVAL;
- }
-
if (test_bit(GB_HID_STARTED, &ghid->flags))
hid_input_report(ghid->hid, HID_INPUT_REPORT,
- request->report + 2, size - 2, 1);
+ request->report, op->request->payload_size, 1);
return 0;
}