greybus: remove gbuf->context
authorAlex Elder <elder@linaro.org>
Thu, 6 Nov 2014 13:01:03 +0000 (07:01 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Thu, 6 Nov 2014 16:03:35 +0000 (08:03 -0800)
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 <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 817e262..af077ff 100644 (file)
@@ -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 */
index 34e8584..a4af64f 100644 (file)
@@ -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
index 20ad452..575e586 100644 (file)
@@ -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;