Merge tag 'iwlwifi-next-for-kalle-2014-12-30' of https://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / arch / x86 / pci / intel_mid_pci.c
index b9958c3..44b9271 100644 (file)
@@ -210,6 +210,9 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
 {
        int polarity;
 
+       if (dev->irq_managed && dev->irq > 0)
+               return 0;
+
        if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER)
                polarity = 0; /* active high */
        else
@@ -224,13 +227,18 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
        if (mp_map_gsi_to_irq(dev->irq, IOAPIC_MAP_ALLOC) < 0)
                return -EBUSY;
 
+       dev->irq_managed = 1;
+
        return 0;
 }
 
 static void intel_mid_pci_irq_disable(struct pci_dev *dev)
 {
-       if (!mp_should_keep_irq(&dev->dev) && dev->irq > 0)
+       if (!mp_should_keep_irq(&dev->dev) && dev->irq_managed &&
+           dev->irq > 0) {
                mp_unmap_irq(dev->irq);
+               dev->irq_managed = 0;
+       }
 }
 
 struct pci_ops intel_mid_pci_ops = {