summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/operation.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-07-26 17:11:30 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2016-07-26 14:53:19 -0700
commit2321f049a93368fffc3375cfbf2f9f9561ef1e69 (patch)
tree0b212e06594da6a22a74c73f08b6d4648ab4f648 /drivers/staging/greybus/operation.c
parent112f563e1879ab73853fed9d875f45d96d5990fd (diff)
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: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/operation.c')
-rw-r--r--drivers/staging/greybus/operation.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c
index b9692b750978..0123109a1070 100644
--- a/drivers/staging/greybus/operation.c
+++ b/drivers/staging/greybus/operation.c
@@ -889,12 +889,17 @@ EXPORT_SYMBOL_GPL(greybus_message_sent);
* data into the request buffer and handle the rest via workqueue.
*/
static void gb_connection_recv_request(struct gb_connection *connection,
- u16 operation_id, u8 type,
- void *data, size_t size)
+ const struct gb_operation_msg_hdr *header,
+ void *data, size_t size)
{
struct gb_operation *operation;
+ u16 operation_id;
+ u8 type;
int ret;
+ operation_id = le16_to_cpu(header->operation_id);
+ type = header->type;
+
operation = gb_operation_create_incoming(connection, operation_id,
type, data, size);
if (!operation) {
@@ -1002,7 +1007,6 @@ void gb_connection_recv(struct gb_connection *connection,
struct gb_operation_msg_hdr header;
struct device *dev = &connection->hd->dev;
size_t msg_size;
- u16 operation_id;
if (connection->state == GB_CONNECTION_STATE_DISABLED ||
gb_connection_is_offloaded(connection)) {
@@ -1029,13 +1033,13 @@ void gb_connection_recv(struct gb_connection *connection,
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,
msg_size);
- else
- gb_connection_recv_request(connection, operation_id,
- header.type, data, msg_size);
+ } else {
+ gb_connection_recv_request(connection, &header, data,
+ msg_size);
+ }
}
/*