aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/msi.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 91fed543fc84..4f326f38f9bf 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -674,10 +674,26 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
674 return status; 674 return status;
675} 675}
676 676
677void pci_disable_msix(struct pci_dev* dev) 677static void msix_free_all_irqs(struct pci_dev *dev)
678{ 678{
679 int irq, head, tail = 0; 679 int irq, head, tail = 0;
680 680
681 irq = head = dev->first_msi_irq;
682 while (head != tail) {
683 tail = get_irq_msi(irq)->link.tail;
684
685 BUG_ON(irq_has_action(irq));
686
687 if (irq != head)
688 msi_free_irq(dev, irq);
689 irq = tail;
690 }
691 msi_free_irq(dev, irq);
692 dev->first_msi_irq = 0;
693}
694
695void pci_disable_msix(struct pci_dev* dev)
696{
681 if (!pci_msi_enable) 697 if (!pci_msi_enable)
682 return; 698 return;
683 if (!dev) 699 if (!dev)
@@ -690,18 +706,7 @@ void pci_disable_msix(struct pci_dev* dev)
690 pci_intx(dev, 1); /* enable intx */ 706 pci_intx(dev, 1); /* enable intx */
691 dev->msix_enabled = 0; 707 dev->msix_enabled = 0;
692 708
693 irq = head = dev->first_msi_irq; 709 msix_free_all_irqs(dev);
694 while (head != tail) {
695 tail = get_irq_msi(irq)->link.tail;
696
697 BUG_ON(irq_has_action(irq));
698
699 if (irq != head) /* Release MSI-X irq */
700 msi_free_irq(dev, irq);
701 irq = tail;
702 }
703 msi_free_irq(dev, irq);
704 dev->first_msi_irq = 0;
705} 710}
706 711
707/** 712/**
@@ -722,23 +727,9 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev)
722 BUG_ON(irq_has_action(dev->first_msi_irq)); 727 BUG_ON(irq_has_action(dev->first_msi_irq));
723 msi_free_irq(dev, dev->first_msi_irq); 728 msi_free_irq(dev, dev->first_msi_irq);
724 } 729 }
725 if (dev->msix_enabled) {
726 int irq, head, tail = 0;
727 void __iomem *base = NULL;
728 730
729 irq = head = dev->first_msi_irq; 731 if (dev->msix_enabled)
730 while (head != tail) { 732 msix_free_all_irqs(dev);
731 tail = get_irq_msi(irq)->link.tail;
732 base = get_irq_msi(irq)->mask_base;
733
734 BUG_ON(irq_has_action(irq));
735
736 if (irq != head) /* Release MSI-X irq */
737 msi_free_irq(dev, irq);
738 irq = tail;
739 }
740 msi_free_irq(dev, irq);
741 }
742} 733}
743 734
744void pci_no_msi(void) 735void pci_no_msi(void)