Commit 4a655ad4 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

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: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: default avatarPatrick Titiano <ptitiano@baylibre.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent f2cfa704
...@@ -917,6 +917,7 @@ struct gb_loopback_transfer_request { ...@@ -917,6 +917,7 @@ struct gb_loopback_transfer_request {
} __packed; } __packed;
struct gb_loopback_transfer_response { struct gb_loopback_transfer_response {
__le32 len;
__u8 data[0]; __u8 data[0];
} __packed; } __packed;
......
...@@ -524,6 +524,7 @@ static int gb_loopback_request_recv(u8 type, struct gb_operation *operation) ...@@ -524,6 +524,7 @@ static int gb_loopback_request_recv(u8 type, struct gb_operation *operation)
return -ENOMEM; return -ENOMEM;
} }
response = operation->response->payload; response = operation->response->payload;
response->len = cpu_to_le32(len);
memcpy(response->data, request->data, len); memcpy(response->data, request->data, len);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment