Commit 2321f049 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: operation: clean up request handler

Clean up the incoming request handler somewhat by passing a properly
aligned header and dropping the now redundant id and type parameters.
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 112f563e
...@@ -889,12 +889,17 @@ EXPORT_SYMBOL_GPL(greybus_message_sent); ...@@ -889,12 +889,17 @@ EXPORT_SYMBOL_GPL(greybus_message_sent);
* data into the request buffer and handle the rest via workqueue. * data into the request buffer and handle the rest via workqueue.
*/ */
static void gb_connection_recv_request(struct gb_connection *connection, static void gb_connection_recv_request(struct gb_connection *connection,
u16 operation_id, u8 type, const struct gb_operation_msg_hdr *header,
void *data, size_t size) void *data, size_t size)
{ {
struct gb_operation *operation; struct gb_operation *operation;
u16 operation_id;
u8 type;
int ret; int ret;
operation_id = le16_to_cpu(header->operation_id);
type = header->type;
operation = gb_operation_create_incoming(connection, operation_id, operation = gb_operation_create_incoming(connection, operation_id,
type, data, size); type, data, size);
if (!operation) { if (!operation) {
...@@ -1002,7 +1007,6 @@ void gb_connection_recv(struct gb_connection *connection, ...@@ -1002,7 +1007,6 @@ void gb_connection_recv(struct gb_connection *connection,
struct gb_operation_msg_hdr header; struct gb_operation_msg_hdr header;
struct device *dev = &connection->hd->dev; struct device *dev = &connection->hd->dev;
size_t msg_size; size_t msg_size;
u16 operation_id;
if (connection->state == GB_CONNECTION_STATE_DISABLED || if (connection->state == GB_CONNECTION_STATE_DISABLED ||
gb_connection_is_offloaded(connection)) { gb_connection_is_offloaded(connection)) {
...@@ -1029,13 +1033,13 @@ void gb_connection_recv(struct gb_connection *connection, ...@@ -1029,13 +1033,13 @@ void gb_connection_recv(struct gb_connection *connection,
return; /* XXX Should still complete operation */ return; /* XXX Should still complete operation */
} }
operation_id = le16_to_cpu(header.operation_id); if (header.type & GB_MESSAGE_TYPE_RESPONSE) {
if (header.type & GB_MESSAGE_TYPE_RESPONSE)
gb_connection_recv_response(connection, &header, data, gb_connection_recv_response(connection, &header, data,
msg_size); msg_size);
else } else {
gb_connection_recv_request(connection, operation_id, gb_connection_recv_request(connection, &header, data,
header.type, data, msg_size); msg_size);
}
} }
/* /*
......
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