aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-08-09 16:27:06 -0400
committerJason Cooper <jason@lakedaemon.net>2013-08-12 11:26:39 -0400
commit4287d824f265451cd10f6d20266b27a207a6cdd7 (patch)
treec98175713116fca3634ceded2c039be9d6f9ed63 /drivers/pci/msi.c
parentad81f0545ef01ea651886dddac4bef6cec930092 (diff)
PCI: use weak functions for MSI arch-specific functions
Until now, the MSI architecture-specific functions could be overloaded using a fairly complex set of #define and compile-time conditionals. In order to prepare for the introduction of the msi_chip infrastructure, it is desirable to switch all those functions to use the 'weak' mechanism. This commit converts all the architectures that were overidding those MSI functions to use the new strategy. Note that we keep two separate, non-weak, functions default_teardown_msi_irqs() and default_restore_msi_irqs() for the default behavior of the arch_teardown_msi_irqs() and arch_restore_msi_irqs(), as the default behavior is needed by x86 PCI code. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Tested-by: Daniel Price <daniel.price@gmail.com> Tested-by: Thierry Reding <thierry.reding@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: linuxppc-dev@lists.ozlabs.org Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: linux390@de.ibm.com Cc: linux-s390@vger.kernel.org Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: x86@kernel.org Cc: Russell King <linux@arm.linux.org.uk> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: linux-ia64@vger.kernel.org Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: David S. Miller <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Cc: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index aca7578b05e5..823c3861c4d8 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -30,20 +30,21 @@ static int pci_msi_enable = 1;
30 30
31/* Arch hooks */ 31/* Arch hooks */
32 32
33#ifndef arch_msi_check_device 33int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
34int arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
35{ 34{
36 return 0; 35 return -EINVAL;
37} 36}
38#endif
39 37
40#ifndef arch_setup_msi_irqs 38void __weak arch_teardown_msi_irq(unsigned int irq)
41# define arch_setup_msi_irqs default_setup_msi_irqs 39{
42# define HAVE_DEFAULT_MSI_SETUP_IRQS 40}
43#endif
44 41
45#ifdef HAVE_DEFAULT_MSI_SETUP_IRQS 42int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
46int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 43{
44 return 0;
45}
46
47int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
47{ 48{
48 struct msi_desc *entry; 49 struct msi_desc *entry;
49 int ret; 50 int ret;
@@ -65,14 +66,11 @@ int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
65 66
66 return 0; 67 return 0;
67} 68}
68#endif
69
70#ifndef arch_teardown_msi_irqs
71# define arch_teardown_msi_irqs default_teardown_msi_irqs
72# define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
73#endif
74 69
75#ifdef HAVE_DEFAULT_MSI_TEARDOWN_IRQS 70/*
71 * We have a default implementation available as a separate non-weak
72 * function, as it is used by the Xen x86 PCI code
73 */
76void default_teardown_msi_irqs(struct pci_dev *dev) 74void default_teardown_msi_irqs(struct pci_dev *dev)
77{ 75{
78 struct msi_desc *entry; 76 struct msi_desc *entry;
@@ -89,14 +87,12 @@ void default_teardown_msi_irqs(struct pci_dev *dev)
89 arch_teardown_msi_irq(entry->irq + i); 87 arch_teardown_msi_irq(entry->irq + i);
90 } 88 }
91} 89}
92#endif
93 90
94#ifndef arch_restore_msi_irqs 91void __weak arch_teardown_msi_irqs(struct pci_dev *dev)
95# define arch_restore_msi_irqs default_restore_msi_irqs 92{
96# define HAVE_DEFAULT_MSI_RESTORE_IRQS 93 return default_teardown_msi_irqs(dev);
97#endif 94}
98 95
99#ifdef HAVE_DEFAULT_MSI_RESTORE_IRQS
100void default_restore_msi_irqs(struct pci_dev *dev, int irq) 96void default_restore_msi_irqs(struct pci_dev *dev, int irq)
101{ 97{
102 struct msi_desc *entry; 98 struct msi_desc *entry;
@@ -114,7 +110,11 @@ void default_restore_msi_irqs(struct pci_dev *dev, int irq)
114 if (entry) 110 if (entry)
115 write_msi_msg(irq, &entry->msg); 111 write_msi_msg(irq, &entry->msg);
116} 112}
117#endif 113
114void __weak arch_restore_msi_irqs(struct pci_dev *dev, int irq)
115{
116 return default_restore_msi_irqs(dev, irq);
117}
118 118
119static void msi_set_enable(struct pci_dev *dev, int enable) 119static void msi_set_enable(struct pci_dev *dev, int enable)
120{ 120{