aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2009-01-18 19:31:00 -0500
committerJesse Barnes <jbarnes@hobbes.lan>2009-03-19 22:29:26 -0400
commit11df1f05514beaf0269484191007dbc8d47e0e6f (patch)
treed4fce7438e5513d86b866c4890a38c0d437df76f /drivers/pci/msi.c
parentb43d451385ef833e0696032aac2629da04d46c59 (diff)
PCI/MSI: Use #ifdefs instead of weak functions
Weak functions aren't all they're cracked up to be. They lead to incorrect binaries with some toolchains, they require us to have empty functions we otherwise wouldn't, and the unused code is not elided (as of gcc 4.3.2 anyway). So replace the weak MSI arch hooks with the #define foo foo idiom. We no longer need empty versions of arch_setup/teardown_msi_irq(). This is less source (by 1 line!), and results in smaller binaries too: text data bss dec hex filename 9354300 1693916 678424 11726640 b2ef30 build/powerpc/vmlinux-before 9354052 1693852 678424 11726328 b2edf8 build/powerpc/vmlinux-after Also smaller on x86_64 and arm (iop13xx). Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 08aedd5875b0..33adf323f064 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -27,20 +27,15 @@ static int pci_msi_enable = 1;
27 27
28/* Arch hooks */ 28/* Arch hooks */
29 29
30int __attribute__ ((weak)) 30#ifndef arch_msi_check_device
31arch_msi_check_device(struct pci_dev *dev, int nvec, int type) 31int arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
32{ 32{
33 return 0; 33 return 0;
34} 34}
35#endif
35 36
36int __attribute__ ((weak)) 37#ifndef arch_setup_msi_irqs
37arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *entry) 38int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
38{
39 return 0;
40}
41
42int __attribute__ ((weak))
43arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
44{ 39{
45 struct msi_desc *entry; 40 struct msi_desc *entry;
46 int ret; 41 int ret;
@@ -53,14 +48,10 @@ arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
53 48
54 return 0; 49 return 0;
55} 50}
51#endif
56 52
57void __attribute__ ((weak)) arch_teardown_msi_irq(unsigned int irq) 53#ifndef arch_teardown_msi_irqs
58{ 54void arch_teardown_msi_irqs(struct pci_dev *dev)
59 return;
60}
61
62void __attribute__ ((weak))
63arch_teardown_msi_irqs(struct pci_dev *dev)
64{ 55{
65 struct msi_desc *entry; 56 struct msi_desc *entry;
66 57
@@ -69,6 +60,7 @@ arch_teardown_msi_irqs(struct pci_dev *dev)
69 arch_teardown_msi_irq(entry->irq); 60 arch_teardown_msi_irq(entry->irq);
70 } 61 }
71} 62}
63#endif
72 64
73static void __msi_set_enable(struct pci_dev *dev, int pos, int enable) 65static void __msi_set_enable(struct pci_dev *dev, int pos, int enable)
74{ 66{