Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53344
b: refs/heads/master
c: 3e916c0
h: refs/heads/master
v: v3
  • Loading branch information
Michael Ellerman authored and Greg Kroah-Hartman committed May 3, 2007
1 parent c004f0b commit d3ac3e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4cc086fa5b648dc3dcd56c963e42a212f2d9df29
refs/heads/master: 3e916c0503a34ba32202a69df1cfeb82f2c5749d
44 changes: 4 additions & 40 deletions trunk/drivers/pci/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,8 @@
#include "pci.h"
#include "msi.h"

static struct kmem_cache* msi_cachep;

static int pci_msi_enable = 1;

static int msi_cache_init(void)
{
msi_cachep = kmem_cache_create("msi_cache", sizeof(struct msi_desc),
0, SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!msi_cachep)
return -ENOMEM;

return 0;
}

static void msi_set_enable(struct pci_dev *dev, int enable)
{
int pos;
Expand Down Expand Up @@ -221,28 +209,12 @@ void unmask_msi_irq(unsigned int irq)

static int msi_free_irq(struct pci_dev* dev, int irq);

static int msi_init(void)
{
static int status = -ENOMEM;

if (!status)
return status;

status = msi_cache_init();
if (status < 0) {
pci_msi_enable = 0;
printk(KERN_WARNING "PCI: MSI cache init failed\n");
return status;
}

return status;
}

static struct msi_desc* alloc_msi_entry(void)
{
struct msi_desc *entry;

entry = kmem_cache_zalloc(msi_cachep, GFP_KERNEL);
entry = kzalloc(sizeof(struct msi_desc), GFP_KERNEL);
if (!entry)
return NULL;

Expand Down Expand Up @@ -368,7 +340,7 @@ static int msi_capability_init(struct pci_dev *dev)
/* Configure MSI capability structure */
irq = arch_setup_msi_irq(dev, entry);
if (irq < 0) {
kmem_cache_free(msi_cachep, entry);
kfree(entry);
return irq;
}
entry->link.head = irq;
Expand Down Expand Up @@ -441,7 +413,7 @@ static int msix_capability_init(struct pci_dev *dev,
/* Configure MSI-X capability structure */
irq = arch_setup_msi_irq(dev, entry);
if (irq < 0) {
kmem_cache_free(msi_cachep, entry);
kfree(entry);
break;
}
entries[i].vector = irq;
Expand Down Expand Up @@ -530,10 +502,6 @@ int pci_enable_msi(struct pci_dev* dev)
if (pci_msi_supported(dev) < 0)
return -EINVAL;

status = msi_init();
if (status < 0)
return status;

pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
if (!pos)
return -EINVAL;
Expand Down Expand Up @@ -604,7 +572,7 @@ static int msi_free_irq(struct pci_dev* dev, int irq)
get_irq_msi(entry->link.tail)->link.head = entry->link.head;

arch_teardown_msi_irq(irq);
kmem_cache_free(msi_cachep, entry);
kfree(entry);

if (type == PCI_CAP_ID_MSIX) {
writel(1, base + entry_nr * PCI_MSIX_ENTRY_SIZE +
Expand Down Expand Up @@ -641,10 +609,6 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
if (!entries || pci_msi_supported(dev) < 0)
return -EINVAL;

status = msi_init();
if (status < 0)
return status;

pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
if (!pos)
return -EINVAL;
Expand Down

0 comments on commit d3ac3e0

Please sign in to comment.