aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiang Liu <[email protected]>2015-07-09 16:00:36 +0800
committerThomas Gleixner <[email protected]>2015-07-22 18:37:42 +0200
commitc179c9b978b90bdf9cb39f5b5716dede157f1eaf (patch)
tree747a85c02a9fd9c4ac9cb33608af8c3f88e2476c
parentfaca10b9e63e880c81388fbbedf7ede6dcd77c70 (diff)
PCI: Add helper function msi_desc_to_pci_sysdata()
Add helper function msi_desc_to_pci_sysdata() to retrieve sysdata from an MSI descriptor. To avoid pulling include/linux/pci.h into include/linux/msi.h, msi_desc_to_pci_sysdata() is implemented as a normal function instead of an inline function. Signed-off-by: Jiang Liu <[email protected]> Reviewed-by: Yijing Wang <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Cc: Tony Luck <[email protected]> Cc: [email protected] Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Stuart Yoder <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Alexander Gordeev <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
-rw-r--r--drivers/pci/msi.c8
-rw-r--r--include/linux/msi.h7
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 157eb8817fb8..ab4174243962 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1137,6 +1137,14 @@ int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
}
EXPORT_SYMBOL(pci_enable_msix_range);
+void *msi_desc_to_pci_sysdata(struct msi_desc *desc)
+{
+ struct pci_dev *dev = msi_desc_to_pci_dev(desc);
+
+ return dev->bus->sysdata;
+}
+EXPORT_SYMBOL_GPL(msi_desc_to_pci_sysdata);
+
#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
/**
* pci_msi_domain_write_msg - Helper to write MSI message to PCI config space
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 8ac4a68ffae2..cfbd2afeaf64 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -60,6 +60,13 @@ static inline struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc)
{
return desc->dev;
}
+
+void *msi_desc_to_pci_sysdata(struct msi_desc *desc);
+#else /* CONFIG_PCI_MSI */
+static inline void *msi_desc_to_pci_sysdata(struct msi_desc *desc)
+{
+ return NULL;
+}
#endif /* CONFIG_PCI_MSI */
void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);