#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;
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;
/* 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;
/* 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;
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;
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 +
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;