Commit 11df1f05 authored by Michael Ellerman's avatar Michael Ellerman Committed by Jesse Barnes

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: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent b43d4513
...@@ -114,6 +114,10 @@ extern int pci_domain_nr(struct pci_bus *bus); ...@@ -114,6 +114,10 @@ extern int pci_domain_nr(struct pci_bus *bus);
/* Decide whether to display the domain number in /proc */ /* Decide whether to display the domain number in /proc */
extern int pci_proc_domain(struct pci_bus *bus); extern int pci_proc_domain(struct pci_bus *bus);
/* MSI arch hooks */
#define arch_setup_msi_irqs arch_setup_msi_irqs
#define arch_teardown_msi_irqs arch_teardown_msi_irqs
#define arch_msi_check_device arch_msi_check_device
struct vm_area_struct; struct vm_area_struct;
/* Map a range of PCI memory or I/O space for a device into user space */ /* Map a range of PCI memory or I/O space for a device into user space */
......
...@@ -86,6 +86,9 @@ static inline void early_quirks(void) { } ...@@ -86,6 +86,9 @@ static inline void early_quirks(void) { }
extern void pci_iommu_alloc(void); extern void pci_iommu_alloc(void);
/* MSI arch hook */
#define arch_setup_msi_irqs arch_setup_msi_irqs
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
......
...@@ -27,20 +27,15 @@ static int pci_msi_enable = 1; ...@@ -27,20 +27,15 @@ static int pci_msi_enable = 1;
/* Arch hooks */ /* Arch hooks */
int __attribute__ ((weak)) #ifndef arch_msi_check_device
arch_msi_check_device(struct pci_dev *dev, int nvec, int type) int arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
{ {
return 0; return 0;
} }
#endif
int __attribute__ ((weak)) #ifndef arch_setup_msi_irqs
arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *entry) int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
{
return 0;
}
int __attribute__ ((weak))
arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
{ {
struct msi_desc *entry; struct msi_desc *entry;
int ret; int ret;
...@@ -53,14 +48,10 @@ arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -53,14 +48,10 @@ arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
return 0; return 0;
} }
#endif
void __attribute__ ((weak)) arch_teardown_msi_irq(unsigned int irq) #ifndef arch_teardown_msi_irqs
{ void arch_teardown_msi_irqs(struct pci_dev *dev)
return;
}
void __attribute__ ((weak))
arch_teardown_msi_irqs(struct pci_dev *dev)
{ {
struct msi_desc *entry; struct msi_desc *entry;
...@@ -69,6 +60,7 @@ arch_teardown_msi_irqs(struct pci_dev *dev) ...@@ -69,6 +60,7 @@ arch_teardown_msi_irqs(struct pci_dev *dev)
arch_teardown_msi_irq(entry->irq); arch_teardown_msi_irq(entry->irq);
} }
} }
#endif
static void __msi_set_enable(struct pci_dev *dev, int pos, int enable) static void __msi_set_enable(struct pci_dev *dev, int pos, int enable)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment