staging: ozwpan: Use slab cache for oz_elt_info allocation
Use a slab cache rather than rolling our own free list.
Signed-off-by: Christoph Jaeger <email@christophjaeger.info>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index 549fe7f..b592e96 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -11,6 +11,7 @@
#include <linux/etherdevice.h>
#include <linux/errno.h>
#include <linux/ieee80211.h>
+#include <linux/slab.h>
#include "ozdbg.h"
#include "ozprotocol.h"
#include "ozeltbuf.h"
@@ -51,6 +52,8 @@
static u16 g_apps = 0x1;
static int g_processing_rx;
+struct kmem_cache *oz_elt_info_cache;
+
/*
* Context: softirq-serialized
*/
@@ -479,6 +482,8 @@
}
spin_unlock_bh(&g_polling_lock);
oz_dbg(ON, "Protocol stopped\n");
+
+ kmem_cache_destroy(oz_elt_info_cache);
}
/*
@@ -762,6 +767,10 @@
*/
int oz_protocol_init(char *devs)
{
+ oz_elt_info_cache = KMEM_CACHE(oz_elt_info, 0);
+ if (!oz_elt_info_cache)
+ return -ENOMEM;
+
skb_queue_head_init(&g_rx_queue);
if (devs[0] == '*') {
oz_binding_add(NULL);