Commit 1f764af7 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: stop storing dest_cport_id in message

We can derive the destination CPort id of any (outbound) message
from the connection it's operation is associated with.  So we don't
need to store that information in every message.

As a result, we no longer need to record it at message initialization
time.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 3ed67aba
...@@ -106,10 +106,11 @@ gb_pending_operation_find(struct gb_connection *connection, u16 id) ...@@ -106,10 +106,11 @@ gb_pending_operation_find(struct gb_connection *connection, u16 id)
static int gb_message_send(struct gb_message *message, gfp_t gfp_mask) static int gb_message_send(struct gb_message *message, gfp_t gfp_mask)
{ {
struct gb_connection *connection = message->operation->connection; struct gb_connection *connection = message->operation->connection;
u16 dest_cport_id = connection->interface_cport_id;
message->status = -EINPROGRESS; message->status = -EINPROGRESS;
message->cookie = connection->hd->driver->buffer_send(connection->hd, message->cookie = connection->hd->driver->buffer_send(connection->hd,
message->dest_cport_id, dest_cport_id,
message->buffer, message->buffer,
message->buffer_size, message->buffer_size,
gfp_mask); gfp_mask);
...@@ -236,7 +237,6 @@ static int gb_operation_message_init(struct gb_operation *operation, ...@@ -236,7 +237,6 @@ static int gb_operation_message_init(struct gb_operation *operation,
struct gb_message *message; struct gb_message *message;
struct gb_operation_msg_hdr *header; struct gb_operation_msg_hdr *header;
gfp_t gfp_flags = request && !outbound ? GFP_ATOMIC : GFP_KERNEL; gfp_t gfp_flags = request && !outbound ? GFP_ATOMIC : GFP_KERNEL;
u16 dest_cport_id;
if (size > GB_OPERATION_MESSAGE_SIZE_MAX) if (size > GB_OPERATION_MESSAGE_SIZE_MAX)
return -E2BIG; return -E2BIG;
...@@ -249,16 +249,10 @@ static int gb_operation_message_init(struct gb_operation *operation, ...@@ -249,16 +249,10 @@ static int gb_operation_message_init(struct gb_operation *operation,
type |= GB_OPERATION_TYPE_RESPONSE; type |= GB_OPERATION_TYPE_RESPONSE;
} }
if (outbound)
dest_cport_id = connection->interface_cport_id;
else
dest_cport_id = CPORT_ID_BAD;
message->buffer = hd->driver->buffer_alloc(size, gfp_flags); message->buffer = hd->driver->buffer_alloc(size, gfp_flags);
if (!message->buffer) if (!message->buffer)
return -ENOMEM; return -ENOMEM;
message->buffer_size = size; message->buffer_size = size;
message->dest_cport_id = dest_cport_id;
message->status = -EBADR; /* Initial value--means "never set" */ message->status = -EBADR; /* Initial value--means "never set" */
/* Fill in the header structure */ /* Fill in the header structure */
......
...@@ -28,7 +28,6 @@ struct gb_message { ...@@ -28,7 +28,6 @@ struct gb_message {
void *payload; void *payload;
struct gb_operation *operation; struct gb_operation *operation;
u16 dest_cport_id; /* Destination CPort id */
int status; int status;
void *buffer; void *buffer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment