From: Alex Elder Date: Tue, 18 Nov 2014 19:26:47 +0000 (-0600) Subject: greybus: rework message initialization X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6a70736aca05d4c8acd80f30bf485dd785ae1a2b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: rework message initialization Rework gb_opreation_message_init() so it doesn't use a struct gbuf local variable. 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 33cc4145db3c..57694e03c187 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -228,7 +228,6 @@ static int gb_operation_message_init(struct gb_operation *operation, struct greybus_host_device *hd = connection->hd; struct gb_message *message; struct gb_operation_msg_hdr *header; - struct gbuf *gbuf; gfp_t gfp_flags = request && !outbound ? GFP_ATOMIC : GFP_KERNEL; u16 dest_cport_id; @@ -242,23 +241,22 @@ static int gb_operation_message_init(struct gb_operation *operation, message = &operation->response; type |= GB_OPERATION_TYPE_RESPONSE; } - gbuf = &message->gbuf; if (outbound) dest_cport_id = connection->interface_cport_id; else dest_cport_id = CPORT_ID_BAD; - gbuf->transfer_buffer = hd->driver->buffer_alloc(size, gfp_flags); - if (!gbuf->transfer_buffer) + message->gbuf.transfer_buffer = hd->driver->buffer_alloc(size, gfp_flags); + if (!message->gbuf.transfer_buffer) return -ENOMEM; - gbuf->transfer_buffer_length = size; - gbuf->hd = hd; - gbuf->dest_cport_id = dest_cport_id; - gbuf->status = -EBADR; /* Initial value--means "never set" */ + message->gbuf.transfer_buffer_length = size; + message->gbuf.hd = hd; + message->gbuf.dest_cport_id = dest_cport_id; + message->gbuf.status = -EBADR; /* Initial value--means "never set" */ /* Fill in the header structure */ - header = (struct gb_operation_msg_hdr *)gbuf->transfer_buffer; + header = message->gbuf.transfer_buffer; header->size = cpu_to_le16(size); header->id = 0; /* Filled in when submitted */ header->type = type;