staging: ozwpan: Use slab cache for oz_tx_frame 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 b592e96..db6ef99 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -53,6 +53,7 @@
static int g_processing_rx;
struct kmem_cache *oz_elt_info_cache;
+struct kmem_cache *oz_tx_frame_cache;
/*
* Context: softirq-serialized
@@ -483,6 +484,7 @@
spin_unlock_bh(&g_polling_lock);
oz_dbg(ON, "Protocol stopped\n");
+ kmem_cache_destroy(oz_tx_frame_cache);
kmem_cache_destroy(oz_elt_info_cache);
}
@@ -771,6 +773,12 @@
if (!oz_elt_info_cache)
return -ENOMEM;
+ oz_tx_frame_cache = KMEM_CACHE(oz_tx_frame, 0);
+ if (!oz_tx_frame_cache) {
+ kmem_cache_destroy(oz_elt_info_cache);
+ return -ENOMEM;
+ }
+
skb_queue_head_init(&g_rx_queue);
if (devs[0] == '*') {
oz_binding_add(NULL);