greybus: kill the gbuf slab cache

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>
This commit is contained in:
Alex Elder 2014-11-17 18:08:36 -06:00 committed by Greg Kroah-Hartman
parent bc46fabccd
commit 4e5007e5c2
3 changed files with 0 additions and 60 deletions

View 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();

View File

@ -13,41 +13,9 @@
#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;
}

View 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);