From 4a655ad4c2b83815ccab5057e29bf0f6c981a94e Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Mon, 14 Sep 2015 10:48:45 +0100 Subject: [PATCH] greybus: loopback: add response len to loopback protocol This patch adds a len field to the loopback protocol. This field is validated in gb_loopback_transfer() and stuffed in gb_loopback_request_recv(). Signed-off-by: Bryan O'Donoghue Reviewed-by: Patrick Titiano Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/greybus_protocols.h | 1 + drivers/staging/greybus/loopback.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index 77a7c49..76fea9a 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -917,6 +917,7 @@ struct gb_loopback_transfer_request { } __packed; struct gb_loopback_transfer_response { + __le32 len; __u8 data[0]; } __packed; diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index a9b901f..ba65457f 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -524,6 +524,7 @@ static int gb_loopback_request_recv(u8 type, struct gb_operation *operation) return -ENOMEM; } response = operation->response->payload; + response->len = cpu_to_le32(len); memcpy(response->data, request->data, len); } return 0; -- 2.7.4