Commit a7672d54 authored by Ben Collins's avatar Ben Collins

IEEE1394(r1176): Remove mempool and ctor stuff.

parent 6255dabb
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <linux/mempool.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
...@@ -58,7 +57,6 @@ MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality."); ...@@ -58,7 +57,6 @@ MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static kmem_cache_t *hpsb_packet_cache; static kmem_cache_t *hpsb_packet_cache;
static mempool_t *hpsb_packet_mempool;
/* Some globals used */ /* Some globals used */
const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" }; const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" };
...@@ -123,24 +121,33 @@ void hpsb_set_packet_complete_task(struct hpsb_packet *packet, ...@@ -123,24 +121,33 @@ void hpsb_set_packet_complete_task(struct hpsb_packet *packet,
*/ */
struct hpsb_packet *hpsb_alloc_packet(size_t data_size) struct hpsb_packet *hpsb_alloc_packet(size_t data_size)
{ {
struct hpsb_packet *packet = NULL; struct hpsb_packet *packet = NULL;
void *data = NULL; void *data = NULL;
int gfp_flags = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
packet = mempool_alloc(hpsb_packet_mempool, GFP_ATOMIC); packet = kmem_cache_alloc(hpsb_packet_cache, gfp_flags);
if (packet == NULL) if (packet == NULL)
return NULL; return NULL;
memset(packet, 0, sizeof(*packet));
if (data_size) { packet->header = packet->embedded_header;
INIT_LIST_HEAD(&packet->list);
packet->state = hpsb_unused;
packet->generation = -1;
atomic_set(&packet->refcnt, 1);
if (data_size) {
data_size = (data_size + 3) & ~3; data_size = (data_size + 3) & ~3;
data = kmalloc(data_size + 8, GFP_ATOMIC); data = kmalloc(data_size + 8, gfp_flags);
if (data == NULL) { if (data == NULL) {
mempool_free(packet, hpsb_packet_mempool); kmem_cache_free(hpsb_packet_cache, packet);
return NULL; return NULL;
} }
packet->data = data; packet->data = data;
packet->data_size = data_size; packet->data_size = data_size;
} }
return packet; return packet;
} }
...@@ -156,7 +163,7 @@ void hpsb_free_packet(struct hpsb_packet *packet) ...@@ -156,7 +163,7 @@ void hpsb_free_packet(struct hpsb_packet *packet)
{ {
if (packet && atomic_dec_and_test(&packet->refcnt)) { if (packet && atomic_dec_and_test(&packet->refcnt)) {
kfree(packet->data); kfree(packet->data);
mempool_free(packet, hpsb_packet_mempool); kmem_cache_free(hpsb_packet_cache, packet);
} }
} }
...@@ -1035,20 +1042,6 @@ static int hpsbpkt_thread(void *__hi) ...@@ -1035,20 +1042,6 @@ static int hpsbpkt_thread(void *__hi)
} }
static void hpsb_packet_ctor(void *__packet, kmem_cache_t *hpsb_pkt_cache, unsigned long flags)
{
struct hpsb_packet *packet = __packet;
memset(packet, 0, sizeof(*packet));
packet->header = packet->embedded_header;
INIT_LIST_HEAD(&packet->list);
packet->state = hpsb_unused;
packet->generation = -1;
atomic_set(&packet->refcnt, 1);
}
static int __init ieee1394_init(void) static int __init ieee1394_init(void)
{ {
int i; int i;
...@@ -1074,14 +1067,7 @@ static int __init ieee1394_init(void) ...@@ -1074,14 +1067,7 @@ static int __init ieee1394_init(void)
devfs_mk_dir("ieee1394"); devfs_mk_dir("ieee1394");
hpsb_packet_cache = kmem_cache_create("hpsb_packet", sizeof(struct hpsb_packet), hpsb_packet_cache = kmem_cache_create("hpsb_packet", sizeof(struct hpsb_packet),
0, SLAB_HWCACHE_ALIGN, hpsb_packet_ctor, NULL); 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
/* Our memory pool keeps 32 packets allocated at all times. The
* default callbacks use the hpsb_packet_cache for the allocation,
* and the hpsb_packet_ctor call back makes sure that the packets
* are setup properly. Smooooth. */
hpsb_packet_mempool = mempool_create(32, mempool_alloc_slab,
mempool_free_slab,
hpsb_packet_cache);
bus_register(&ieee1394_bus_type); bus_register(&ieee1394_bus_type);
for (i = 0; fw_bus_attrs[i]; i++) for (i = 0; fw_bus_attrs[i]; i++)
...@@ -1118,7 +1104,6 @@ static void __exit ieee1394_cleanup(void) ...@@ -1118,7 +1104,6 @@ static void __exit ieee1394_cleanup(void)
wait_for_completion(&khpsbpkt_complete); wait_for_completion(&khpsbpkt_complete);
} }
mempool_destroy(hpsb_packet_mempool);
kmem_cache_destroy(hpsb_packet_cache); kmem_cache_destroy(hpsb_packet_cache);
hpsb_cleanup_config_roms(); hpsb_cleanup_config_roms();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment