Skip to content

Commit

Permalink
[PATCH] msi: use kmem_cache_zalloc()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pekka J Enberg authored and Linus Torvalds committed Sep 27, 2006
1 parent 7583ddf commit 5718178
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions drivers/pci/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,10 @@ msi_register(struct msi_ops *ops)
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)
{
msi_cachep = kmem_cache_create("msi_cache",
sizeof(struct msi_desc),
0, SLAB_HWCACHE_ALIGN, msi_cache_ctor, NULL);
msi_cachep = kmem_cache_create("msi_cache", sizeof(struct msi_desc),
0, SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!msi_cachep)
return -ENOMEM;

Expand Down Expand Up @@ -402,11 +396,10 @@ static struct msi_desc* alloc_msi_entry(void)
{
struct msi_desc *entry;

entry = kmem_cache_alloc(msi_cachep, SLAB_KERNEL);
entry = kmem_cache_zalloc(msi_cachep, GFP_KERNEL);
if (!entry)
return NULL;

memset(entry, 0, sizeof(struct msi_desc));
entry->link.tail = entry->link.head = 0; /* single message */
entry->dev = NULL;

Expand Down

0 comments on commit 5718178

Please sign in to comment.