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

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 360a8779
......@@ -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;
......
......@@ -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
......
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