summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2014-07-08 04:09:19 +0200
committerBjorn Helgaas <bhelgaas@google.com>2014-07-16 22:49:02 +0200
commite11ece5a5e4292243076290d22bf2860a541e223 (patch)
tree9c772ae1a4d80fcac0f95740a6dca25662ab9e13 /drivers/pci
parentPCI/MSI: Remove unused list access in __pci_restore_msix_state() (diff)
downloadlinux-e11ece5a5e4292243076290d22bf2860a541e223.tar.xz
linux-e11ece5a5e4292243076290d22bf2860a541e223.zip
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: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 84da13c00a34..5a40516444f3 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -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;
}