Commit b0b65755 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: specify type when creating an operation

The type of an operation belongs in the operation header, which
shouldn't be touched by users of the interface.  So specify it
at operation creation time.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 652433f3
......@@ -111,7 +111,7 @@ static void gbuf_out_callback(struct gbuf *gbuf)
* failure occurs due to memory exhaustion.
*/
struct gb_operation *gb_operation_create(struct gb_connection *connection,
size_t size)
size_t size, u8 type)
{
struct gb_operation *operation;
struct gb_operation_msg_hdr *header;
......@@ -139,8 +139,9 @@ struct gb_operation *gb_operation_create(struct gb_connection *connection,
/* Fill in the header structure and payload pointer */
operation->gbuf = gbuf;
header = (struct gb_operation_msg_hdr *)&gbuf->transfer_buffer;
header->id = 0;
header->size = cpu_to_le16(size);
header->id = 0; /* Filled in when submitted */
header->type = type;
operation->payload = (char *)header + sizeof(*header);
operation->callback = NULL; /* set at submit time */
......
......@@ -60,7 +60,7 @@ struct gb_operation {
};
struct gb_operation *gb_operation_create(struct gb_connection *connection,
size_t size);
size_t size, u8 type);
void gb_operation_destroy(struct gb_operation *operation);
int gb_operation_wait(struct gb_operation *operation);
......
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