Subject: [PATCH 1/3] [POWERPC] implement machine specific PCI fixup calls

From: Anton Vorontsov <[email-masked]>
Date: Thu, 8 May 2008 18:20:45 +0400

These are similar to machine_initcalls, but works for the PCI fixups.
We need this to apply machine specific fixups for the same PCI devices.

Signed-off-by: Anton Vorontsov <[email-masked]>
---
 include/asm-powerpc/pci.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index a05a942..03fdc58 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -224,5 +224,21 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
 extern void pcibios_do_bus_setup(struct pci_bus *bus);
 extern void pcibios_fixup_of_probed_bus(struct pci_bus *bus);
 
+#define DEFINE_MACHINE_PCIFIXUP(type, mach, vendor, device, hook)        \
+	static void __devinit                                            \
+	__machine_pcifixup_##mach##_##hook(struct pci_dev *dev) {        \
+		if (machine_is(mach))                                    \
+			hook(dev);                                       \
+	}                                                                \
+	DECLARE_PCI_FIXUP_##type(vendor, device,                         \
+				 __machine_pcifixup_##mach##_##hook)
+
+#define MACH_PCI_FIXUP_EARLY(mach, vendor, device, hook) \
+	DEFINE_MACHINE_PCIFIXUP(EARLY, mach, vendor, device, hook)
+#define MACH_PCI_FIXUP_FINAL(mach, vendor, device, hook) \
+	DEFINE_MACHINE_PCIFIXUP(FINAL, mach, vendor, device, hook)
+#define MACH_PCI_FIXUP_HEADER(mach, vendor, device, hook) \
+	DEFINE_MACHINE_PCIFIXUP(HEADER, mach, vendor, device, hook)
+
 #endif	/* __KERNEL__ */
 #endif /* __ASM_POWERPC_PCI_H */
-- 
1.5.5.1