Commit d40f540c authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

msi: Remove msi_lock.

With the removal of msi_lookup_irq all of the functions using msi_lock
operated on a single device and none of them could reasonably be
called on that device at the same time. 

Since what little synchronization that needs to happen needs to happen
outside of the msi functions, msi_lock could never be contended and as
such is useless and just complicates the code.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ded86d8d
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "pci.h" #include "pci.h"
#include "msi.h" #include "msi.h"
static DEFINE_SPINLOCK(msi_lock);
static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL }; static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL };
static struct kmem_cache* msi_cachep; static struct kmem_cache* msi_cachep;
...@@ -196,11 +195,7 @@ static struct msi_desc* alloc_msi_entry(void) ...@@ -196,11 +195,7 @@ static struct msi_desc* alloc_msi_entry(void)
static void attach_msi_entry(struct msi_desc *entry, int irq) static void attach_msi_entry(struct msi_desc *entry, int irq)
{ {
unsigned long flags;
spin_lock_irqsave(&msi_lock, flags);
msi_desc[irq] = entry; msi_desc[irq] = entry;
spin_unlock_irqrestore(&msi_lock, flags);
} }
static int create_msi_irq(void) static int create_msi_irq(void)
...@@ -672,7 +667,6 @@ void pci_disable_msi(struct pci_dev* dev) ...@@ -672,7 +667,6 @@ void pci_disable_msi(struct pci_dev* dev)
struct msi_desc *entry; struct msi_desc *entry;
int pos, default_irq; int pos, default_irq;
u16 control; u16 control;
unsigned long flags;
if (!pci_msi_enable) if (!pci_msi_enable)
return; return;
...@@ -693,21 +687,17 @@ void pci_disable_msi(struct pci_dev* dev) ...@@ -693,21 +687,17 @@ void pci_disable_msi(struct pci_dev* dev)
disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); disable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
spin_lock_irqsave(&msi_lock, flags);
entry = msi_desc[dev->first_msi_irq]; entry = msi_desc[dev->first_msi_irq];
if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) {
spin_unlock_irqrestore(&msi_lock, flags);
return; return;
} }
if (irq_has_action(dev->first_msi_irq)) { if (irq_has_action(dev->first_msi_irq)) {
spin_unlock_irqrestore(&msi_lock, flags);
printk(KERN_WARNING "PCI: %s: pci_disable_msi() called without " printk(KERN_WARNING "PCI: %s: pci_disable_msi() called without "
"free_irq() on MSI irq %d\n", "free_irq() on MSI irq %d\n",
pci_name(dev), dev->first_msi_irq); pci_name(dev), dev->first_msi_irq);
BUG_ON(irq_has_action(dev->first_msi_irq)); BUG_ON(irq_has_action(dev->first_msi_irq));
} else { } else {
default_irq = entry->msi_attrib.default_irq; default_irq = entry->msi_attrib.default_irq;
spin_unlock_irqrestore(&msi_lock, flags);
msi_free_irq(dev, dev->first_msi_irq); msi_free_irq(dev, dev->first_msi_irq);
/* Restore dev->irq to its default pin-assertion irq */ /* Restore dev->irq to its default pin-assertion irq */
...@@ -721,14 +711,11 @@ static int msi_free_irq(struct pci_dev* dev, int irq) ...@@ -721,14 +711,11 @@ static int msi_free_irq(struct pci_dev* dev, int irq)
struct msi_desc *entry; struct msi_desc *entry;
int head, entry_nr, type; int head, entry_nr, type;
void __iomem *base; void __iomem *base;
unsigned long flags;
arch_teardown_msi_irq(irq); arch_teardown_msi_irq(irq);
spin_lock_irqsave(&msi_lock, flags);
entry = msi_desc[irq]; entry = msi_desc[irq];
if (!entry || entry->dev != dev) { if (!entry || entry->dev != dev) {
spin_unlock_irqrestore(&msi_lock, flags);
return -EINVAL; return -EINVAL;
} }
type = entry->msi_attrib.type; type = entry->msi_attrib.type;
...@@ -739,7 +726,6 @@ static int msi_free_irq(struct pci_dev* dev, int irq) ...@@ -739,7 +726,6 @@ static int msi_free_irq(struct pci_dev* dev, int irq)
msi_desc[entry->link.tail]->link.head = entry->link.head; msi_desc[entry->link.tail]->link.head = entry->link.head;
entry->dev = NULL; entry->dev = NULL;
msi_desc[irq] = NULL; msi_desc[irq] = NULL;
spin_unlock_irqrestore(&msi_lock, flags);
destroy_msi_irq(irq); destroy_msi_irq(irq);
...@@ -817,7 +803,6 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) ...@@ -817,7 +803,6 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
void pci_disable_msix(struct pci_dev* dev) void pci_disable_msix(struct pci_dev* dev)
{ {
int irq, head, tail = 0, warning = 0; int irq, head, tail = 0, warning = 0;
unsigned long flags;
int pos; int pos;
u16 control; u16 control;
...@@ -841,9 +826,7 @@ void pci_disable_msix(struct pci_dev* dev) ...@@ -841,9 +826,7 @@ void pci_disable_msix(struct pci_dev* dev)
irq = head = dev->first_msi_irq; irq = head = dev->first_msi_irq;
while (head != tail) { while (head != tail) {
spin_lock_irqsave(&msi_lock, flags);
tail = msi_desc[irq]->link.tail; tail = msi_desc[irq]->link.tail;
spin_unlock_irqrestore(&msi_lock, flags);
if (irq_has_action(irq)) if (irq_has_action(irq))
warning = 1; warning = 1;
else if (irq != head) /* Release MSI-X irq */ else if (irq != head) /* Release MSI-X irq */
...@@ -872,7 +855,6 @@ void pci_disable_msix(struct pci_dev* dev) ...@@ -872,7 +855,6 @@ void pci_disable_msix(struct pci_dev* dev)
void msi_remove_pci_irq_vectors(struct pci_dev* dev) void msi_remove_pci_irq_vectors(struct pci_dev* dev)
{ {
int pos; int pos;
unsigned long flags;
if (!pci_msi_enable || !dev) if (!pci_msi_enable || !dev)
return; return;
...@@ -894,10 +876,8 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev) ...@@ -894,10 +876,8 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev)
irq = head = dev->first_msi_irq; irq = head = dev->first_msi_irq;
while (head != tail) { while (head != tail) {
spin_lock_irqsave(&msi_lock, flags);
tail = msi_desc[irq]->link.tail; tail = msi_desc[irq]->link.tail;
base = msi_desc[irq]->mask_base; base = msi_desc[irq]->mask_base;
spin_unlock_irqrestore(&msi_lock, flags);
if (irq_has_action(irq)) if (irq_has_action(irq))
warning = 1; warning = 1;
else if (irq != head) /* Release MSI-X irq */ else if (irq != head) /* Release MSI-X irq */
......
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