greybus: kill gbuf->complete
authorAlex Elder <elder@linaro.org>
Thu, 6 Nov 2014 13:01:06 +0000 (07:01 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Thu, 6 Nov 2014 16:03:36 +0000 (08:03 -0800)
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: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/gbuf.c
drivers/staging/greybus/greybus.h
drivers/staging/greybus/operation.c

index 1e5562e..8b5a438 100644 (file)
@@ -35,7 +35,6 @@ static struct kmem_cache *gbuf_head_cache;
  * hardware designers for this issue...
  */
 struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation,
-                               gbuf_complete_t complete,
                                unsigned int size,
                                bool outbound,
                                gfp_t gfp_mask)
@@ -51,7 +50,6 @@ struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation,
        kref_init(&gbuf->kref);
        gbuf->operation = operation;
        gbuf->outbound = outbound;
-       gbuf->complete = complete;
        gbuf->status = -EBADR;  /* Initial value--means "never set" */
 
        /* Host controller specific allocation for the actual buffer */
index 6f2369e..296a6a2 100644 (file)
 
 */
 
-
-struct gbuf;
-
-typedef void (*gbuf_complete_t)(struct gbuf *gbuf);
-
 struct gbuf {
        struct kref kref;
 
@@ -134,7 +129,6 @@ struct gbuf {
        bool outbound;                  /* AP-relative data direction */
 
        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,
                        u8 *data, size_t length);
 
 struct gbuf *greybus_alloc_gbuf(struct gb_operation *operation,
-                               gbuf_complete_t complete, unsigned int size,
-                               bool outbound, gfp_t gfp_mask);
+                               unsigned int size, 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
index 16ee7ce..302ab00 100644 (file)
@@ -264,7 +264,7 @@ static void gb_operation_recv_work(struct work_struct *recv_work)
                gbuf = operation->request;
        else
                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,
        gfp_t gfp_flags = data_out ? GFP_KERNEL : GFP_ATOMIC;
 
        size += sizeof(*header);
-       gbuf = greybus_alloc_gbuf(operation, gb_operation_gbuf_complete,
-                                       size, data_out, gfp_flags);
+       gbuf = greybus_alloc_gbuf(operation, size, data_out, gfp_flags);
        if (!gbuf)
                return NULL;