Commit e11ece5a authored by Yijing Wang's avatar Yijing Wang Committed by Bjorn Helgaas

PCI/MSI: Use irq_get_msi_desc() to simplify code

Use irq_get_msi_desc() to get MSI IRQ related msi_desc directly instead of
searching the dev->msi_list.
Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 0dae508a
...@@ -487,7 +487,6 @@ EXPORT_SYMBOL_GPL(pci_restore_msi_state); ...@@ -487,7 +487,6 @@ EXPORT_SYMBOL_GPL(pci_restore_msi_state);
static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr, static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
struct msi_desc *entry; struct msi_desc *entry;
unsigned long irq; unsigned long irq;
int retval; int retval;
...@@ -496,12 +495,11 @@ static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr, ...@@ -496,12 +495,11 @@ static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
if (retval) if (retval)
return retval; return retval;
list_for_each_entry(entry, &pdev->msi_list, list) { entry = irq_get_msi_desc(irq);
if (entry->irq == irq) { if (entry)
return sprintf(buf, "%s\n", return sprintf(buf, "%s\n",
entry->msi_attrib.is_msix ? "msix" : "msi"); entry->msi_attrib.is_msix ? "msix" : "msi");
}
}
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment