Commit 57181784 authored by Pekka J Enberg's avatar Pekka J Enberg Committed by Linus Torvalds

[PATCH] msi: use kmem_cache_zalloc()

Simpler, cleaner.
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7583ddfd
...@@ -45,16 +45,10 @@ msi_register(struct msi_ops *ops) ...@@ -45,16 +45,10 @@ msi_register(struct msi_ops *ops)
return 0; return 0;
} }
static void msi_cache_ctor(void *p, kmem_cache_t *cache, unsigned long flags)
{
memset(p, 0, sizeof(struct msi_desc));
}
static int msi_cache_init(void) static int msi_cache_init(void)
{ {
msi_cachep = kmem_cache_create("msi_cache", msi_cachep = kmem_cache_create("msi_cache", sizeof(struct msi_desc),
sizeof(struct msi_desc), 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
0, SLAB_HWCACHE_ALIGN, msi_cache_ctor, NULL);
if (!msi_cachep) if (!msi_cachep)
return -ENOMEM; return -ENOMEM;
...@@ -402,11 +396,10 @@ static struct msi_desc* alloc_msi_entry(void) ...@@ -402,11 +396,10 @@ static struct msi_desc* alloc_msi_entry(void)
{ {
struct msi_desc *entry; struct msi_desc *entry;
entry = kmem_cache_alloc(msi_cachep, SLAB_KERNEL); entry = kmem_cache_zalloc(msi_cachep, GFP_KERNEL);
if (!entry) if (!entry)
return NULL; return NULL;
memset(entry, 0, sizeof(struct msi_desc));
entry->link.tail = entry->link.head = 0; /* single message */ entry->link.tail = entry->link.head = 0; /* single message */
entry->dev = NULL; entry->dev = NULL;
......
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