Skip to contentSkip to conversation

PCI/MSI: Use irq_get_msi_desc() to simplify code

PATCH Applied Yijing Wang 1 participant 1 message Jul 8, 2014 PCI

lore
Share & tools
lore
#0 lore raw

PATCH v3 6/6 PCI/MSI: Use irq_get_msi_desc() to simplify code

Use irq_get_msi_desc() to get MSI irq related msi_desc directly.

---
 drivers/pci/msi.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
drivers/pci/msi.c +5 -7
index 3bee1ba..f95af2b 100644
@@ -487,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;
@@ -496,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;
 }
 
Signature · 1 line
1.7.1