PCI/MSI: Use irq_get_msi_desc() to simplify code
[deliverable/linux.git] / drivers / pci / msi.c
index a59d673d074e5492abab9b3e7a16d23e61b9a28b..5a40516444f33d4c46f6067e089434b9e7840cda 100644 (file)
@@ -235,7 +235,7 @@ static void msi_set_mask_bit(struct irq_data *data, u32 flag)
                msix_mask_irq(desc, flag);
                readl(desc->mask_base);         /* Flush write to device */
        } else {
-               unsigned offset = data->irq - desc->dev->irq;
+               unsigned offset = data->irq - desc->irq;
                msi_mask_irq(desc, 1 << offset, flag << offset);
        }
 }
@@ -463,7 +463,6 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
        if (!dev->msix_enabled)
                return;
        BUG_ON(list_empty(&dev->msi_list));
-       entry = list_first_entry(&dev->msi_list, struct msi_desc, list);
 
        /* route the table */
        pci_intx_for_msi(dev, 0);
@@ -488,7 +487,6 @@ EXPORT_SYMBOL_GPL(pci_restore_msi_state);
 static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
                             char *buf)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
        struct msi_desc *entry;
        unsigned long irq;
        int retval;
@@ -497,12 +495,11 @@ static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
        if (retval)
                return retval;
 
-       list_for_each_entry(entry, &pdev->msi_list, list) {
-               if (entry->irq == irq) {
-                       return sprintf(buf, "%s\n",
-                                      entry->msi_attrib.is_msix ? "msix" : "msi");
-               }
-       }
+       entry = irq_get_msi_desc(irq);
+       if (entry)
+               return sprintf(buf, "%s\n",
+                               entry->msi_attrib.is_msix ? "msix" : "msi");
+
        return -ENODEV;
 }
 
@@ -1014,24 +1011,6 @@ void pci_disable_msix(struct pci_dev *dev)
 }
 EXPORT_SYMBOL(pci_disable_msix);
 
-/**
- * msi_remove_pci_irq_vectors - reclaim MSI(X) irqs to unused state
- * @dev: pointer to the pci_dev data structure of MSI(X) device function
- *
- * Being called during hotplug remove, from which the device function
- * is hot-removed. All previous assigned MSI/MSI-X irqs, if
- * allocated for this device function, are reclaimed to unused state,
- * which may be used later on.
- **/
-void msi_remove_pci_irq_vectors(struct pci_dev *dev)
-{
-       if (!pci_msi_enable || !dev)
-               return;
-
-       if (dev->msi_enabled || dev->msix_enabled)
-               free_msi_irqs(dev);
-}
-
 void pci_no_msi(void)
 {
        pci_msi_enable = 0;
This page took 0.024228 seconds and 5 git commands to generate.