aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorPekka J Enberg <penberg@cs.Helsinki.FI>2006-09-27 04:51:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:19 -0400
commit571817849c76aabf34d534c905b5e604f2e824c5 (patch)
tree5541946f87861b66e2612e623edccf81b8f42c70 /drivers/pci/msi.c
parent7583ddfd3aae1007bc4fc67ea4c07d573d376e9e (diff)
[PATCH] msi: use kmem_cache_zalloc()
Simpler, cleaner. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 008235947aa4..27a057409eca 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -45,16 +45,10 @@ msi_register(struct msi_ops *ops)
45 return 0; 45 return 0;
46} 46}
47 47
48static void msi_cache_ctor(void *p, kmem_cache_t *cache, unsigned long flags)
49{
50 memset(p, 0, sizeof(struct msi_desc));
51}
52
53static int msi_cache_init(void) 48static int msi_cache_init(void)
54{ 49{
55 msi_cachep = kmem_cache_create("msi_cache", 50 msi_cachep = kmem_cache_create("msi_cache", sizeof(struct msi_desc),
56 sizeof(struct msi_desc), 51 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
57 0, SLAB_HWCACHE_ALIGN, msi_cache_ctor, NULL);
58 if (!msi_cachep) 52 if (!msi_cachep)
59 return -ENOMEM; 53 return -ENOMEM;
60 54
@@ -402,11 +396,10 @@ static struct msi_desc* alloc_msi_entry(void)
402{ 396{
403 struct msi_desc *entry; 397 struct msi_desc *entry;
404 398
405 entry = kmem_cache_alloc(msi_cachep, SLAB_KERNEL); 399 entry = kmem_cache_zalloc(msi_cachep, GFP_KERNEL);
406 if (!entry) 400 if (!entry)
407 return NULL; 401 return NULL;
408 402
409 memset(entry, 0, sizeof(struct msi_desc));
410 entry->link.tail = entry->link.head = 0; /* single message */ 403 entry->link.tail = entry->link.head = 0; /* single message */
411 entry->dev = NULL; 404 entry->dev = NULL;
412 405