From: Alex Elder Date: Tue, 2 Dec 2014 14:30:28 +0000 (-0600) Subject: greybus: move copy of incoming request data X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1802 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=34db1f91e674ba8c7df674ac6692c2604ea1ece5;p=karo-tx-linux.git greybus: move copy of incoming request data Currently incoming request data is copied into a request message buffer in gb_connection_recv_request(). Move that--along with the assignment of the message id--into gb_operation_create_incoming(). Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index d973b57dc693..1e0ce7d98618 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -465,11 +465,19 @@ struct gb_operation *gb_operation_create(struct gb_connection *connection, static struct gb_operation * gb_operation_create_incoming(struct gb_connection *connection, - u8 type, size_t request_size, - size_t response_size) + u16 operation_id, u8 type, + void *data, size_t request_size) { - return gb_operation_create_common(connection, false, type, - request_size, response_size); + struct gb_operation *operation; + + operation = gb_operation_create_common(connection, false, type, + request_size, 0); + if (operation) { + operation->id = operation_id; + memcpy(operation->request->header, data, request_size); + } + + return operation; } /* @@ -622,13 +630,12 @@ static void gb_connection_recv_request(struct gb_connection *connection, { struct gb_operation *operation; - operation = gb_operation_create_incoming(connection, type, size, 0); + operation = gb_operation_create_incoming(connection, operation_id, + type, data, size); if (!operation) { gb_connection_err(connection, "can't create operation"); return; /* XXX Respond with pre-allocated ENOMEM */ } - operation->id = operation_id; - memcpy(operation->request->header, data, size); /* XXX Right now this will just complete the operation */ if (gb_operation_result_set(operation, -ENOSYS))