greybus: kill the gbuf slab cache
authorAlex Elder <elder@linaro.org>
Tue, 18 Nov 2014 00:08:36 +0000 (18:08 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 18 Nov 2014 01:19:20 +0000 (17:19 -0800)
Nobody dynamically allocates gbufs any more, so we can get rid of
the allocation and free routines, as as the slab cache and its
related code.

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

index 26e4b44bdf44dbca2d487c52d033280e902b2c98..588e62412fd3a391fdf82a701f769c75b9a57c2d 100644 (file)
@@ -226,12 +226,6 @@ static int __init gb_init(void)
                goto error_ap;
        }
 
-       retval = gb_gbuf_init();
-       if (retval) {
-               pr_err("gb_gbuf_init failed\n");
-               goto error_gbuf;
-       }
-
        retval = gb_operation_init();
        if (retval) {
                pr_err("gb_operation_init failed\n");
@@ -250,8 +244,6 @@ static int __init gb_init(void)
 error_protocol:
        gb_operation_exit();
 error_operation:
-       gb_gbuf_exit();
-error_gbuf:
        gb_ap_exit();
 error_ap:
        bus_unregister(&greybus_bus_type);
@@ -265,7 +257,6 @@ static void __exit gb_exit(void)
 {
        gb_protocol_exit();
        gb_operation_exit();
-       gb_gbuf_exit();
        gb_ap_exit();
        bus_unregister(&greybus_bus_type);
        gb_debugfs_cleanup();
index 5ffd257de68facfbdec4b7734676dc4323d71089..d47cf367e412cd9f0885d4fda6a84d4a7f16bfaa 100644 (file)
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
-#include <linux/slab.h>
 
 #include "greybus.h"
 
-static struct kmem_cache *gbuf_head_cache;
-
-/**
- * greybus_alloc_gbuf - allocate a greybus buffer
- *
- * @gmod: greybus device that wants to allocate this
- * @cport: cport to send the data to
- * @complete: callback when the gbuf is finished with
- * @size: size of the buffer
- * @gfp_mask: allocation mask
- *
- * 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
- * that the driver can then fill up with the data to be sent out.  Curse
- * hardware designers for this issue...
- */
-struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd,
-                               u16 dest_cport_id,
-                               unsigned int size,
-                               gfp_t gfp_mask)
-{
-       return kmem_cache_zalloc(gbuf_head_cache, gfp_mask);
-}
-EXPORT_SYMBOL_GPL(greybus_alloc_gbuf);
-
-void greybus_free_gbuf(struct gbuf *gbuf)
-{
-       kmem_cache_free(gbuf_head_cache, gbuf);
-}
-EXPORT_SYMBOL_GPL(greybus_free_gbuf);
-
 int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
 {
        gbuf->status = -EINPROGRESS;
@@ -77,16 +45,3 @@ void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
        gb_connection_operation_recv(connection, data, length);
 }
 EXPORT_SYMBOL_GPL(greybus_cport_in);
-
-int gb_gbuf_init(void)
-{
-       gbuf_head_cache = kmem_cache_create("gbuf_head_cache",
-                                           sizeof(struct gbuf), 0, 0, NULL);
-       return 0;
-}
-
-void gb_gbuf_exit(void)
-{
-       kmem_cache_destroy(gbuf_head_cache);
-       gbuf_head_cache = NULL;
-}
index e1f918d50df2e8035c68aa6c95569134a3aef75d..30d5625ea4ff80b4f6960451b56fc886dd4d5327 100644 (file)
@@ -105,12 +105,6 @@ void greybus_remove_hd(struct greybus_host_device *hd);
 void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
                        u8 *data, size_t length);
 
-struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd,
-                               u16 dest_cport_id,
-                               unsigned int size,
-                               gfp_t gfp_mask);
-void greybus_free_gbuf(struct gbuf *gbuf);
-
 int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t mem_flags);
 void greybus_kill_gbuf(struct gbuf *gbuf);