aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-11-15 09:24:03 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-11-23 07:01:45 -0500
commitd31eb342409b24e3d2e1989c775f3361e93acc08 (patch)
tree3111e846abcb5cbbc6fcfbe81cc81cefdfd2e391
parent280510f1060b4fb2f5853a92b7723e5330529338 (diff)
PCI/MSI: Introduce helpers to hide struct msi_desc implementation details
Introduce helpers to hide struct msi_desc implementation details, so we could easily support non-PCI-compliant MSI devices later by moving msi_list into struct device. Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Cc: Tony Luck <tony.luck@intel.com> Cc: linux-arm-kernel@lists.infradead.org Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Yijing Wang <wangyijing@huawei.com> Cc: Yingjoe Chen <yingjoe.chen@mediatek.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Alexander Gordeev <agordeev@redhat.com> Link: http://lkml.kernel.org/r/1416061447-9472-6-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/msi.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 1dcad0c1e806..e0d08517bd3d 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -43,6 +43,25 @@ struct msi_desc {
43 struct msi_msg msg; 43 struct msi_msg msg;
44}; 44};
45 45
46/* Helpers to hide struct msi_desc implementation details */
47#define msi_desc_to_dev(desc) (&(desc)->dev.dev)
48#define dev_to_msi_list(dev) (&to_pci_dev((dev))->msi_list)
49#define first_msi_entry(dev) \
50 list_first_entry(dev_to_msi_list((dev)), struct msi_desc, list)
51#define for_each_msi_entry(desc, dev) \
52 list_for_each_entry((desc), dev_to_msi_list((dev)), list)
53
54#ifdef CONFIG_PCI_MSI
55#define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev)
56#define for_each_pci_msi_entry(desc, pdev) \
57 for_each_msi_entry((desc), &(pdev)->dev)
58
59static inline struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc)
60{
61 return desc->dev;
62}
63#endif /* CONFIG_PCI_MSI */
64
46void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 65void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
47void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 66void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
48void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg); 67void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);