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: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
Alex Elder
2014-11-18 12:53:38 -08:00
committed by Greg Kroah-Hartman
parent 3ed67aba9f
commit 1f764af77c
2 changed files with 2 additions and 9 deletions
+2 -8
View File
@@ -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)
{
struct gb_connection *connection = message->operation->connection;
u16 dest_cport_id = connection->interface_cport_id;
message->status = -EINPROGRESS;
message->cookie = connection->hd->driver->buffer_send(connection->hd,
message->dest_cport_id,
dest_cport_id,
message->buffer,
message->buffer_size,
gfp_mask);
@@ -236,7 +237,6 @@ static int gb_operation_message_init(struct gb_operation *operation,
struct gb_message *message;
struct gb_operation_msg_hdr *header;
gfp_t gfp_flags = request && !outbound ? GFP_ATOMIC : GFP_KERNEL;
u16 dest_cport_id;
if (size > GB_OPERATION_MESSAGE_SIZE_MAX)
return -E2BIG;
@@ -249,16 +249,10 @@ static int gb_operation_message_init(struct gb_operation *operation,
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);
if (!message->buffer)
return -ENOMEM;
message->buffer_size = size;
message->dest_cport_id = dest_cport_id;
message->status = -EBADR; /* Initial value--means "never set" */
/* Fill in the header structure */
-1
View File
@@ -28,7 +28,6 @@ struct gb_message {
void *payload;
struct gb_operation *operation;
u16 dest_cport_id; /* Destination CPort id */
int status;
void *buffer;