From: Thomas Petazzoni Date: Fri, 9 Aug 2013 20:27:09 +0000 (+0200) Subject: of: pci: add registry of MSI chips X-Git-Tag: KARO-TX6-2014-07-10~139 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b7d406d03322ee6ccb69188744116dda581bf561;p=karo-tx-linux.git of: pci: add registry of MSI chips This commit adds a very basic registry of msi_chip structures, so that an IRQ controller driver can register an msi_chip, and a PCIe host controller can find it, based on a 'struct device_node'. Signed-off-by: Thomas Petazzoni Acked-by: Benjamin Herrenschmidt Acked-by: Rob Herring Signed-off-by: Jason Cooper --- diff --git a/include/linux/msi.h b/include/linux/msi.h index 0ef1579d692e..b243a258c1d2 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -83,6 +83,8 @@ struct msi_chip { struct msi_chip { struct module *owner; struct device *dev; + struct device_node *of_node; + struct list_head list; int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev, struct msi_desc *desc); diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index dde3a4a0fa5d..d737c53932c0 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -56,4 +56,15 @@ static inline struct msi_chip * of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; } #endif +#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) +int of_pci_msi_chip_add(struct msi_chip *chip); +void of_pci_msi_chip_remove(struct msi_chip *chip); +struct msi_chip *of_pci_find_msi_chip_by_node(struct device_node *of_node); +#else +static inline int of_pci_msi_chip_add(struct msi_chip *chip) { return -EINVAL; } +static inline void of_pci_msi_chip_remove(struct msi_chip *chip) { } +static inline struct msi_chip * +of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; } +#endif + #endif