From c3cf278533c6e5f3df385afce8eb11889e58cfe3 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Wed, 12 Nov 2014 15:17:55 -0600 Subject: [PATCH] greybus: pass operation type on request receive When an incoming request is received, the operation type is encoded in the header and is not available in the payload. Add the operation type as a parameter to the request_recv method so the request handler knows what to do. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 5 +++-- drivers/staging/greybus/protocol.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 72e5ef9..f455452 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -137,16 +137,17 @@ static void gb_operation_request_handle(struct gb_operation *operation) struct gb_protocol *protocol = operation->connection->protocol; struct gb_operation_msg_hdr *header; + header = operation->request->transfer_buffer; + /* * If the protocol has no incoming request handler, report * an error and mark the request bad. */ if (protocol->request_recv) { - protocol->request_recv(operation); + protocol->request_recv(header->type, operation); goto out; } - header = operation->request->transfer_buffer; gb_connection_err(operation->connection, "unexpected incoming request type 0x%02hhx\n", header->type); operation->result = GB_OP_PROTOCOL_BAD; diff --git a/drivers/staging/greybus/protocol.h b/drivers/staging/greybus/protocol.h index f57f0db..1aeb340 100644 --- a/drivers/staging/greybus/protocol.h +++ b/drivers/staging/greybus/protocol.h @@ -15,7 +15,7 @@ struct gb_operation; typedef int (*gb_connection_init_t)(struct gb_connection *); typedef void (*gb_connection_exit_t)(struct gb_connection *); -typedef void (*gb_request_recv_t)(struct gb_operation *); +typedef void (*gb_request_recv_t)(u8, struct gb_operation *); /* * Protocols having the same id but different major and/or minor -- 2.7.4