summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>2015-09-14 10:48:45 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-09-14 21:38:12 -0700
commit4a655ad4c2b83815ccab5057e29bf0f6c981a94e (patch)
tree7d9b00d8b4baa7a9f86ef869e242748a5ab2e517
parentf2cfa7043940cdda5c9e945b1cf5c66da172bc33 (diff)
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 <bryan.odonoghue@linaro.org> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r--drivers/staging/greybus/greybus_protocols.h1
-rw-r--r--drivers/staging/greybus/loopback.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h
index 77a7c4956929..76fea9a8ef27 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 a9b901fbeb5c..ba65457f9f70 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;