From 3a0e3c3efde8655958dc10673f374a8cc983cca2 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Thu, 6 Nov 2014 07:01:05 -0600 Subject: [PATCH] greybus: move gb_operation_gbuf_complete() Simple move of a block of code, done as a separate commit to make it easier to see that's all that's going on. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 86 ++++++++++++++--------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 6bb7568e2f86..16ee7ce2cfaa 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -198,6 +198,49 @@ out: gb_operation_complete(operation); } +/* + * Buffer completion function. We get notified whenever any buffer + * completes. For outbound messages, this tells us that the message + * has been sent. For inbound messages, it means the data has + * landed in the buffer and is ready to be processed. + * + * Either way, we don't do anything. We don't really care when an + * outbound message has been sent, and for incoming messages we + * we'll be done with everything we need to do before we mark it + * finished. + * + * XXX We may want to record that a request is (or is no longer) in flight. + */ +static void gb_operation_gbuf_complete(struct gbuf *gbuf) +{ + if (gbuf->status) { + struct gb_operation *operation = gbuf->operation; + struct gb_operation_msg_hdr *header; + int id; + int type; + + if (gbuf == operation->request) + header = operation->request->transfer_buffer; + else if (gbuf == operation->response) + header = operation->response->transfer_buffer; + else + header = NULL; + + if (header) { + id = le16_to_cpu(header->id); + type = header->type; + } else { + id = -1; + type = -1; + } + + gb_connection_err(operation->connection, + "operation %d type %d gbuf error %d", + id, type, gbuf->status); + } + return; +} + /* * Either this operation contains an incoming request, or its * response has arrived. An incoming request will have a null @@ -242,49 +285,6 @@ static void operation_timeout(struct work_struct *work) gb_operation_complete(operation); } -/* - * Buffer completion function. We get notified whenever any buffer - * completes. For outbound messages, this tells us that the message - * has been sent. For inbound messages, it means the data has - * landed in the buffer and is ready to be processed. - * - * Either way, we don't do anything. We don't really care when an - * outbound message has been sent, and for incoming messages we - * we'll be done with everything we need to do before we mark it - * finished. - * - * XXX We may want to record that a request is (or is no longer) in flight. - */ -static void gb_operation_gbuf_complete(struct gbuf *gbuf) -{ - if (gbuf->status) { - struct gb_operation *operation = gbuf->operation; - struct gb_operation_msg_hdr *header; - int id; - int type; - - if (gbuf == operation->request) - header = operation->request->transfer_buffer; - else if (gbuf == operation->response) - header = operation->response->transfer_buffer; - else - header = NULL; - - if (header) { - id = le16_to_cpu(header->id); - type = header->type; - } else { - id = -1; - type = -1; - } - - gb_connection_err(operation->connection, - "operation %d type %d gbuf error %d", - id, type, gbuf->status); - } - return; -} - /* * Allocate a buffer to be used for an operation request or response * message. For outgoing messages, both types of message contain a -- 2.20.1