Commit 5d2207e7 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: kill gbuf->complete

The gbuf complete method is a callback that allows the creator of a
gbuf to know when all processing on a gbuf is done.

We now only ever allocate gbufs for use in Greybus operations, and
in that case we only ever supply gb_operation_gbuf_complete() as the
completion callback.  Furthermore, the only place gbuf->complete()
is called is in gb_operation_recv_work().

Knowing this, we can just call gb_operation_gbuf_complete() directly
from gb_operation_recv_work(), and get rid of the gbuf->complete()
method entirely.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 3a0e3c3e
...@@ -35,7 +35,6 @@ static struct kmem_cache *gbuf_head_cache; ...@@ -35,7 +35,6 @@ static struct kmem_cache *gbuf_head_cache;
* hardware designers for this issue... * hardware designers for this issue...
*/ */
struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation, struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation,
gbuf_complete_t complete,
unsigned int size, unsigned int size,
bool outbound, bool outbound,
gfp_t gfp_mask) gfp_t gfp_mask)
...@@ -51,7 +50,6 @@ struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation, ...@@ -51,7 +50,6 @@ struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation,
kref_init(&gbuf->kref); kref_init(&gbuf->kref);
gbuf->operation = operation; gbuf->operation = operation;
gbuf->outbound = outbound; gbuf->outbound = outbound;
gbuf->complete = complete;
gbuf->status = -EBADR; /* Initial value--means "never set" */ gbuf->status = -EBADR; /* Initial value--means "never set" */
/* Host controller specific allocation for the actual buffer */ /* Host controller specific allocation for the actual buffer */
......
...@@ -118,11 +118,6 @@ ...@@ -118,11 +118,6 @@
*/ */
struct gbuf;
typedef void (*gbuf_complete_t)(struct gbuf *gbuf);
struct gbuf { struct gbuf {
struct kref kref; struct kref kref;
...@@ -134,7 +129,6 @@ struct gbuf { ...@@ -134,7 +129,6 @@ struct gbuf {
bool outbound; /* AP-relative data direction */ bool outbound; /* AP-relative data direction */
void *hcd_data; /* for the HCD to track the gbuf */ void *hcd_data; /* for the HCD to track the gbuf */
gbuf_complete_t complete;
}; };
...@@ -193,8 +187,8 @@ void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id, ...@@ -193,8 +187,8 @@ void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
u8 *data, size_t length); u8 *data, size_t length);
struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation, struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation,
gbuf_complete_t complete, unsigned int size, unsigned int size, bool outbound,
bool outbound, gfp_t gfp_mask); gfp_t gfp_mask);
void greybus_free_gbuf(struct gbuf *gbuf); void greybus_free_gbuf(struct gbuf *gbuf);
struct gbuf *greybus_get_gbuf(struct gbuf *gbuf); struct gbuf *greybus_get_gbuf(struct gbuf *gbuf);
#define greybus_put_gbuf greybus_free_gbuf #define greybus_put_gbuf greybus_free_gbuf
......
...@@ -264,7 +264,7 @@ static void gb_operation_recv_work(struct work_struct *recv_work) ...@@ -264,7 +264,7 @@ static void gb_operation_recv_work(struct work_struct *recv_work)
gbuf = operation->request; gbuf = operation->request;
else else
gbuf = operation->response; gbuf = operation->response;
gbuf->complete(gbuf); gb_operation_gbuf_complete(gbuf);
} }
/* /*
...@@ -302,8 +302,7 @@ static struct gbuf *gb_operation_gbuf_create(struct gb_operation *operation, ...@@ -302,8 +302,7 @@ static struct gbuf *gb_operation_gbuf_create(struct gb_operation *operation,
gfp_t gfp_flags = data_out ? GFP_KERNEL : GFP_ATOMIC; gfp_t gfp_flags = data_out ? GFP_KERNEL : GFP_ATOMIC;
size += sizeof(*header); size += sizeof(*header);
gbuf = greybus_alloc_gbuf(operation, gb_operation_gbuf_complete, gbuf = greybus_alloc_gbuf(operation, size, data_out, gfp_flags);
size, data_out, gfp_flags);
if (!gbuf) if (!gbuf)
return NULL; return NULL;
......
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