All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/MSI: Use irq_get_msi_desc() to simplify code
@ 2014-07-04  8:43 Yijing Wang
  2014-07-08  2:11 ` Yijing Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Yijing Wang @ 2014-07-04  8:43 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, Wuyun, Xinwei Hu, Yijing Wang

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

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/msi.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 3bee1ba..f95af2b 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;
 }
 
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-08  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-04  8:43 [PATCH] PCI/MSI: Use irq_get_msi_desc() to simplify code Yijing Wang
2014-07-08  2:11 ` Yijing Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.