From a77b06809b9214e23e603248d7609d6efa55f833 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Thu, 6 Nov 2014 07:01:03 -0600 Subject: [PATCH] greybus: remove gbuf->context A gbuf now records a pointer to its operation. The only thing ever stored in a gbuf context pointer is the gbuf's operation. Therefore there's no longer any need to maintain the context pointer, so get rid of it. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/gbuf.c | 5 +---- drivers/staging/greybus/greybus.h | 3 +-- drivers/staging/greybus/operation.c | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/greybus/gbuf.c b/drivers/staging/greybus/gbuf.c index 817e26249f29..af077ff4d257 100644 --- a/drivers/staging/greybus/gbuf.c +++ b/drivers/staging/greybus/gbuf.c @@ -28,7 +28,6 @@ static struct kmem_cache *gbuf_head_cache; * @complete: callback when the gbuf is finished with * @size: size of the buffer * @gfp_mask: allocation mask - * @context: context added to the gbuf by the driver * * TODO: someday it will be nice to handle DMA, but for now, due to the * architecture we are stuck with, the greybus core has to allocate the buffer @@ -39,8 +38,7 @@ struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation, gbuf_complete_t complete, unsigned int size, bool outbound, - gfp_t gfp_mask, - void *context) + gfp_t gfp_mask) { struct greybus_host_device *hd = operation->connection->hd; struct gbuf *gbuf; @@ -54,7 +52,6 @@ struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation, gbuf->operation = operation; gbuf->outbound = outbound; gbuf->complete = complete; - gbuf->context = context; gbuf->status = -EBADR; /* Initial value--means "never set" */ /* Host controller specific allocation for the actual buffer */ diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index 34e8584905ee..a4af64f934c4 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -133,7 +133,6 @@ struct gbuf { bool outbound; /* AP-relative data direction */ - void *context; void *hcd_data; /* for the HCD to track the gbuf */ gbuf_complete_t complete; }; @@ -196,7 +195,7 @@ void greybus_gbuf_finished(struct gbuf *gbuf); struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation, gbuf_complete_t complete, unsigned int size, - bool outbound, gfp_t gfp_mask, void *context); + bool outbound, gfp_t gfp_mask); void greybus_free_gbuf(struct gbuf *gbuf); struct gbuf *greybus_get_gbuf(struct gbuf *gbuf); #define greybus_put_gbuf greybus_free_gbuf diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 20ad4527418b..575e586ee8cf 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -256,7 +256,7 @@ static void operation_timeout(struct work_struct *work) static void gb_operation_gbuf_complete(struct gbuf *gbuf) { if (gbuf->status) { - struct gb_operation *operation = gbuf->context; + struct gb_operation *operation = gbuf->operation; struct gb_operation_msg_hdr *header; int id; int type; @@ -301,7 +301,7 @@ static struct gbuf *gb_operation_gbuf_create(struct gb_operation *operation, size += sizeof(*header); gbuf = greybus_alloc_gbuf(operation, gb_operation_gbuf_complete, - size, data_out, gfp_flags, operation); + size, data_out, gfp_flags); if (!gbuf) return NULL; -- 2.20.1