Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fc4afc7b2bdd81e2dbded5a8222676d3161758d3
Commit:     fc4afc7b2bdd81e2dbded5a8222676d3161758d3
Parent:     00ba16ab2658afe11d4fdcaf16a331292c44bee6
Author:     Michael Ellerman <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 22 21:51:33 2007 +1100
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed May 2 19:02:36 2007 -0700

    MSI: Consolidate MSI-X irq freeing code
    
    For the MSI-X case we do exactly the same logic in pci_disable_msix() and
    msi_remove_pci_irq_vectors(), so consolidate them.
    
    msi_remove_pci_irq_vectors() wasn't setting dev->first_msi_irq to 0, but
    I think it should have been, so the consolidated version does.
    
    Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
    Acked-by: Eric W. Biederman <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/pci/msi.c |   49 ++++++++++++++++++++-----------------------------
 1 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 91fed54..4f326f3 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)
        return status;
 }
 
-void pci_disable_msix(struct pci_dev* dev)
+static void msix_free_all_irqs(struct pci_dev *dev)
 {
        int irq, head, tail = 0;
 
+       irq = head = dev->first_msi_irq;
+       while (head != tail) {
+               tail = get_irq_msi(irq)->link.tail;
+
+               BUG_ON(irq_has_action(irq));
+
+               if (irq != head)
+                       msi_free_irq(dev, irq);
+               irq = tail;
+       }
+       msi_free_irq(dev, irq);
+       dev->first_msi_irq = 0;
+}
+
+void pci_disable_msix(struct pci_dev* dev)
+{
        if (!pci_msi_enable)
                return;
        if (!dev)
@@ -690,18 +706,7 @@ void pci_disable_msix(struct pci_dev* dev)
        pci_intx(dev, 1);               /* enable intx */
        dev->msix_enabled = 0;
 
-       irq = head = dev->first_msi_irq;
-       while (head != tail) {
-               tail = get_irq_msi(irq)->link.tail;
-
-               BUG_ON(irq_has_action(irq));
-
-               if (irq != head)        /* Release MSI-X irq */
-                       msi_free_irq(dev, irq);
-               irq = tail;
-       }
-       msi_free_irq(dev, irq);
-       dev->first_msi_irq = 0;
+       msix_free_all_irqs(dev);
 }
 
 /**
@@ -722,23 +727,9 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev)
                BUG_ON(irq_has_action(dev->first_msi_irq));
                msi_free_irq(dev, dev->first_msi_irq);
        }
-       if (dev->msix_enabled) {
-               int irq, head, tail = 0;
-               void __iomem *base = NULL;
 
-               irq = head = dev->first_msi_irq;
-               while (head != tail) {
-                       tail = get_irq_msi(irq)->link.tail;
-                       base = get_irq_msi(irq)->mask_base;
-
-                       BUG_ON(irq_has_action(irq));
-
-                       if (irq != head) /* Release MSI-X irq */
-                               msi_free_irq(dev, irq);
-                       irq = tail;
-               }
-               msi_free_irq(dev, irq);
-       }
+       if (dev->msix_enabled)
+               msix_free_all_irqs(dev);
 }
 
 void pci_no_msi(void)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to