aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2014-11-11 17:22:45 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-11-12 09:56:15 -0500
commit262a2baf9e4a2fcedb6645ca98d77a1c12303a1d (patch)
treefdb14cdf9ff08208e1d0af9cd2229cb631f5894c
parentc2791b806988100cc1c047e2b0b5c5d0914aa3b6 (diff)
PCI/MSI: Add weak pcibios_msi_controller()
Add pcibios_msi_controller() to get the msi_controller associated with a PCI device. This is to allow arches to store the msi_controller in the arch-specific PCI sysdata. [bhelgaas: changelog, take pci_dev instead of pci_bus] Suggested-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/msi.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 0260f3933211..6c1c1b9665aa 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -30,9 +30,24 @@ int pci_msi_ignore_mask;
30 30
31/* Arch hooks */ 31/* Arch hooks */
32 32
33struct msi_controller * __weak pcibios_msi_controller(struct pci_dev *dev)
34{
35 return NULL;
36}
37
38static struct msi_controller *pci_msi_controller(struct pci_dev *dev)
39{
40 struct msi_controller *msi_ctrl = dev->bus->msi;
41
42 if (msi_ctrl)
43 return msi_ctrl;
44
45 return pcibios_msi_controller(dev);
46}
47
33int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) 48int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
34{ 49{
35 struct msi_controller *chip = dev->bus->msi; 50 struct msi_controller *chip = pci_msi_controller(dev);
36 int err; 51 int err;
37 52
38 if (!chip || !chip->setup_irq) 53 if (!chip || !chip->setup_irq)