mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 11:11:22 -04:00
greybus: gbuf: have caller set actual_length
A Greybus buffer has both a transfer_buffer_size field, which is the size in bytes of the transfer buffer, and an actual_length field, which is the number of bytes in that buffer that are actually consumed. The user of the buffer--and not the buffer allocation method--should be setting the actual_length field. Stop setting the actual length on the es1-ap-usb alloc_gbuf_data method. And *do* set it in gb_operation_create(), where we can presume the operation being allocated will consume all the bytes requested. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
937d0da83f
commit
652433f3fe
@@ -126,7 +126,6 @@ static int alloc_gbuf_data(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask)
|
||||
buffer[0] = gbuf->cport_id;
|
||||
gbuf->transfer_buffer = &buffer[1];
|
||||
gbuf->transfer_buffer_length = size;
|
||||
gbuf->actual_length = size;
|
||||
|
||||
/* When we send the gbuf, we need this pointer to be here */
|
||||
gbuf->hdpriv = es1;
|
||||
|
||||
@@ -132,6 +132,7 @@ struct gb_operation *gb_operation_create(struct gb_connection *connection,
|
||||
kfree(operation);
|
||||
return NULL;
|
||||
}
|
||||
gbuf->actual_length = size; /* Record what we'll use */
|
||||
|
||||
operation->connection = connection; /* XXX refcount? */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user