Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
2321f049 112f563e

+12 -8
+12 -8
drivers/staging/greybus/operation.c
··· 889 889 * data into the request buffer and handle the rest via workqueue. 890 890 */ 891 891 static void gb_connection_recv_request(struct gb_connection *connection, 892 - u16 operation_id, u8 type, 893 - void *data, size_t size) 892 + const struct gb_operation_msg_hdr *header, 893 + void *data, size_t size) 894 894 { 895 895 struct gb_operation *operation; 896 + u16 operation_id; 897 + u8 type; 896 898 int ret; 899 + 900 + operation_id = le16_to_cpu(header->operation_id); 901 + type = header->type; 897 902 898 903 operation = gb_operation_create_incoming(connection, operation_id, 899 904 type, data, size); ··· 1007 1002 struct gb_operation_msg_hdr header; 1008 1003 struct device *dev = &connection->hd->dev; 1009 1004 size_t msg_size; 1010 - u16 operation_id; 1011 1005 1012 1006 if (connection->state == GB_CONNECTION_STATE_DISABLED || 1013 1007 gb_connection_is_offloaded(connection)) { ··· 1033 1029 return; /* XXX Should still complete operation */ 1034 1030 } 1035 1031 1036 - operation_id = le16_to_cpu(header.operation_id); 1037 - if (header.type & GB_MESSAGE_TYPE_RESPONSE) 1032 + if (header.type & GB_MESSAGE_TYPE_RESPONSE) { 1038 1033 gb_connection_recv_response(connection, &header, data, 1039 1034 msg_size); 1040 - else 1041 - gb_connection_recv_request(connection, operation_id, 1042 - header.type, data, msg_size); 1035 + } else { 1036 + gb_connection_recv_request(connection, &header, data, 1037 + msg_size); 1038 + } 1043 1039 } 1044 1040 1045 1041 /*