]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: kill __alloc_gbuf()
authorAlex Elder <elder@linaro.org>
Mon, 6 Oct 2014 11:53:12 +0000 (06:53 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 6 Oct 2014 15:56:43 +0000 (08:56 -0700)
GEt rid of __alloc_gbuf(), now that it's used in only one place.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/gbuf.c

index 62d0cb63a83edc2e9e90d567e37efff1a8e09bc1..2ef6ead8ed17fcc9b5d69fb2f2408f8fefb16e1b 100644 (file)
@@ -26,28 +26,6 @@ static struct kmem_cache *gbuf_head_cache;
 /* Workqueue to handle Greybus buffer completions. */
 static struct workqueue_struct *gbuf_workqueue;
 
-static struct gbuf *__alloc_gbuf(struct gb_connection *connection,
-                               bool outbound,
-                               gbuf_complete_t complete,
-                               gfp_t gfp_mask,
-                               void *context)
-{
-       struct gbuf *gbuf;
-
-       gbuf = kmem_cache_zalloc(gbuf_head_cache, gfp_mask);
-       if (!gbuf)
-               return NULL;
-
-       kref_init(&gbuf->kref);
-       gbuf->connection = connection;
-       INIT_WORK(&gbuf->event, cport_process_event);
-       gbuf->outbound = outbound;
-       gbuf->complete = complete;
-       gbuf->context = context;
-
-       return gbuf;
-}
-
 /**
  * greybus_alloc_gbuf - allocate a greybus buffer
  *
@@ -73,14 +51,21 @@ struct gbuf *greybus_alloc_gbuf(struct gb_connection *connection,
        struct gbuf *gbuf;
        int retval;
 
-       gbuf = __alloc_gbuf(connection, outbound, complete, gfp_mask, context);
+       gbuf = kmem_cache_zalloc(gbuf_head_cache, gfp_mask);
        if (!gbuf)
                return NULL;
 
+       kref_init(&gbuf->kref);
+       gbuf->connection = connection;
+       INIT_WORK(&gbuf->event, cport_process_event);
+       gbuf->outbound = outbound;
+       gbuf->complete = complete;
+       gbuf->context = context;
+
        /* Host controller specific allocation for the actual buffer */
        retval = connection->hd->driver->alloc_gbuf_data(gbuf, size, gfp_mask);
        if (retval) {
-               greybus_free_gbuf(gbuf);
+               kmem_cache_free(gbuf_head_cache, gbuf);
                return NULL;
        }