From b0b657555c8f9bb64189a0ff8824de1ad992f889 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Fri, 3 Oct 2014 15:05:20 -0500 Subject: [PATCH] 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: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 5 +++-- drivers/staging/greybus/operation.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 75f6e50b2ee6..03f6660616b3 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -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 */ diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h index 96a7a0fcba56..0dff703bb2f4 100644 --- a/drivers/staging/greybus/operation.h +++ b/drivers/staging/greybus/operation.h @@ -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); -- 2.20.1