aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-01-28 14:44:21 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 18:50:07 -0500
commitd40f540ce6d992d4123827dbd62f68c4a39c53d0 (patch)
tree10c379bd4a0612b4d5f2ebceac376eebed4d84f3 /drivers/pci
parentded86d8d37736df67ddeec4ae00e2ec1a5a90b3c (diff)
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: Eric W. Biederman <ebiederm@xmission.com> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index b945470bef18..0df626cf47d8 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -24,7 +24,6 @@
24#include "pci.h" 24#include "pci.h"
25#include "msi.h" 25#include "msi.h"
26 26
27static DEFINE_SPINLOCK(msi_lock);
28static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL }; 27static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL };
29static struct kmem_cache* msi_cachep; 28static struct kmem_cache* msi_cachep;
30 29
@@ -196,11 +195,7 @@ static struct msi_desc* alloc_msi_entry(void)
196 195
197static void attach_msi_entry(struct msi_desc *entry, int irq) 196static void attach_msi_entry(struct msi_desc *entry, int irq)
198{ 197{
199 unsigned long flags;
200
201 spin_lock_irqsave(&msi_lock, flags);
202 msi_desc[irq] = entry; 198 msi_desc[irq] = entry;
203 spin_unlock_irqrestore(&msi_lock, flags);
204} 199}
205 200
206static int create_msi_irq(void) 201static int create_msi_irq(void)
@@ -672,7 +667,6 @@ void pci_disable_msi(struct pci_dev* dev)
672 struct msi_desc *entry; 667 struct msi_desc *entry;
673 int pos, default_irq; 668 int pos, default_irq;
674 u16 control; 669 u16 control;
675 unsigned long flags;
676 670
677 if (!pci_msi_enable) 671 if (!pci_msi_enable)
678 return; 672 return;
@@ -693,21 +687,17 @@ void pci_disable_msi(struct pci_dev* dev)
693 687
694 disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); 688 disable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
695 689
696 spin_lock_irqsave(&msi_lock, flags);
697 entry = msi_desc[dev->first_msi_irq]; 690 entry = msi_desc[dev->first_msi_irq];
698 if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { 691 if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) {
699 spin_unlock_irqrestore(&msi_lock, flags);
700 return; 692 return;
701 } 693 }
702 if (irq_has_action(dev->first_msi_irq)) { 694 if (irq_has_action(dev->first_msi_irq)) {
703 spin_unlock_irqrestore(&msi_lock, flags);
704 printk(KERN_WARNING "PCI: %s: pci_disable_msi() called without " 695 printk(KERN_WARNING "PCI: %s: pci_disable_msi() called without "
705 "free_irq() on MSI irq %d\n", 696 "free_irq() on MSI irq %d\n",
706 pci_name(dev), dev->first_msi_irq); 697 pci_name(dev), dev->first_msi_irq);
707 BUG_ON(irq_has_action(dev->first_msi_irq)); 698 BUG_ON(irq_has_action(dev->first_msi_irq));
708 } else { 699 } else {
709 default_irq = entry->msi_attrib.default_irq; 700 default_irq = entry->msi_attrib.default_irq;
710 spin_unlock_irqrestore(&msi_lock, flags);
711 msi_free_irq(dev, dev->first_msi_irq); 701 msi_free_irq(dev, dev->first_msi_irq);
712 702
713 /* Restore dev->irq to its default pin-assertion irq */ 703 /* 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 struct msi_desc *entry; 711 struct msi_desc *entry;
722 int head, entry_nr, type; 712 int head, entry_nr, type;
723 void __iomem *base; 713 void __iomem *base;
724 unsigned long flags;
725 714
726 arch_teardown_msi_irq(irq); 715 arch_teardown_msi_irq(irq);
727 716
728 spin_lock_irqsave(&msi_lock, flags);
729 entry = msi_desc[irq]; 717 entry = msi_desc[irq];
730 if (!entry || entry->dev != dev) { 718 if (!entry || entry->dev != dev) {
731 spin_unlock_irqrestore(&msi_lock, flags);
732 return -EINVAL; 719 return -EINVAL;
733 } 720 }
734 type = entry->msi_attrib.type; 721 type = entry->msi_attrib.type;
@@ -739,7 +726,6 @@ static int msi_free_irq(struct pci_dev* dev, int irq)
739 msi_desc[entry->link.tail]->link.head = entry->link.head; 726 msi_desc[entry->link.tail]->link.head = entry->link.head;
740 entry->dev = NULL; 727 entry->dev = NULL;
741 msi_desc[irq] = NULL; 728 msi_desc[irq] = NULL;
742 spin_unlock_irqrestore(&msi_lock, flags);
743 729
744 destroy_msi_irq(irq); 730 destroy_msi_irq(irq);
745 731
@@ -817,7 +803,6 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
817void pci_disable_msix(struct pci_dev* dev) 803void pci_disable_msix(struct pci_dev* dev)
818{ 804{
819 int irq, head, tail = 0, warning = 0; 805 int irq, head, tail = 0, warning = 0;
820 unsigned long flags;
821 int pos; 806 int pos;
822 u16 control; 807 u16 control;
823 808
@@ -841,9 +826,7 @@ void pci_disable_msix(struct pci_dev* dev)
841 826
842 irq = head = dev->first_msi_irq; 827 irq = head = dev->first_msi_irq;
843 while (head != tail) { 828 while (head != tail) {
844 spin_lock_irqsave(&msi_lock, flags);
845 tail = msi_desc[irq]->link.tail; 829 tail = msi_desc[irq]->link.tail;
846 spin_unlock_irqrestore(&msi_lock, flags);
847 if (irq_has_action(irq)) 830 if (irq_has_action(irq))
848 warning = 1; 831 warning = 1;
849 else if (irq != head) /* Release MSI-X irq */ 832 else if (irq != head) /* Release MSI-X irq */
@@ -872,7 +855,6 @@ void pci_disable_msix(struct pci_dev* dev)
872void msi_remove_pci_irq_vectors(struct pci_dev* dev) 855void msi_remove_pci_irq_vectors(struct pci_dev* dev)
873{ 856{
874 int pos; 857 int pos;
875 unsigned long flags;
876 858
877 if (!pci_msi_enable || !dev) 859 if (!pci_msi_enable || !dev)
878 return; 860 return;
@@ -894,10 +876,8 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev)
894 876
895 irq = head = dev->first_msi_irq; 877 irq = head = dev->first_msi_irq;
896 while (head != tail) { 878 while (head != tail) {
897 spin_lock_irqsave(&msi_lock, flags);
898 tail = msi_desc[irq]->link.tail; 879 tail = msi_desc[irq]->link.tail;
899 base = msi_desc[irq]->mask_base; 880 base = msi_desc[irq]->mask_base;
900 spin_unlock_irqrestore(&msi_lock, flags);
901 if (irq_has_action(irq)) 881 if (irq_has_action(irq))
902 warning = 1; 882 warning = 1;
903 else if (irq != head) /* Release MSI-X irq */ 883 else if (irq != head) /* Release MSI-X irq */