]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
greybus: rework receve handling
authorAlex Elder <elder@linaro.org>
Tue, 18 Nov 2014 19:26:50 +0000 (13:26 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 18 Nov 2014 20:50:34 +0000 (12:50 -0800)
Rework gb_connection_operation_recv() to be more oriented toward an
operation message, and to no longer use a struct gbuf local variable.
Rename it to be a little more wieldy.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/operation.c
drivers/staging/greybus/operation.h

index 258d96cdba671cdc905b25c99dfe431837212f20..584f491642617b987703fcf1bf7ef848ea8d8360 100644 (file)
@@ -40,7 +40,7 @@ void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
                        "nonexistent connection (%zu bytes dropped)\n", length);
                return;
        }
-       gb_connection_operation_recv(connection, data, length);
+       gb_connection_recv(connection, data, length);
 }
 EXPORT_SYMBOL_GPL(greybus_cport_in);
 
index 5d5cce68680e8444ce0568e81af1cdf027cb99d7..254864effe2733fb78f344b276bdb8f200c7d1e8 100644 (file)
@@ -431,12 +431,12 @@ int gb_operation_response_send(struct gb_operation *operation)
  * data into the buffer and do remaining handling via a work queue.
  *
  */
-void gb_connection_operation_recv(struct gb_connection *connection,
+void gb_connection_recv(struct gb_connection *connection,
                                void *data, size_t size)
 {
        struct gb_operation_msg_hdr *header;
        struct gb_operation *operation;
-       struct gbuf *gbuf;
+       struct gb_message *message;
        u16 msg_size;
 
        if (connection->state != GB_CONNECTION_STATE_ENABLED)
@@ -459,8 +459,8 @@ void gb_connection_operation_recv(struct gb_connection *connection,
                }
                cancel_delayed_work(&operation->timeout_work);
                gb_pending_operation_remove(operation);
-               gbuf = &operation->response.gbuf;
-               if (size > gbuf->transfer_buffer_length) {
+               message = &operation->response;
+               if (size > message->gbuf.transfer_buffer_length) {
                        operation->result = GB_OP_OVERFLOW;
                        gb_connection_err(connection, "recv buffer too small");
                        return;
@@ -474,10 +474,10 @@ void gb_connection_operation_recv(struct gb_connection *connection,
                        gb_connection_err(connection, "can't create operation");
                        return;
                }
-               gbuf = &operation->request.gbuf;
+               message = &operation->request;
        }
 
-       memcpy(gbuf->transfer_buffer, data, msg_size);
+       memcpy(message->gbuf.transfer_buffer, data, msg_size);
 
        /* The rest will be handled in work queue context */
        queue_work(gb_operation_recv_workqueue, &operation->recv_work);
index f43531dbcf3321f65e8b582bbc3b740b6f1a6e62..a9d4b8a1adc376ed46a21da12eec130a7875c411 100644 (file)
@@ -87,7 +87,7 @@ struct gb_operation {
        struct list_head        links;  /* connection->{operations,pending} */
 };
 
-void gb_connection_operation_recv(struct gb_connection *connection,
+void gb_connection_recv(struct gb_connection *connection,
                                        void *data, size_t size);
 
 struct gb_operation *gb_operation_create(struct gb_connection *connection,