From: Matthew Wilcox The recent change that allowed PCI fixups to be declared everywhere broke IDE on PA-RISC by making the generic IDE fixup be applied before the PA-RISC specific one. This patch fixes that by sorting generic fixups after the specific ones. It also obeys the 80-column limit and reduces the amount of grotty macro code. I'd like to thank Joel Soete for his work tracking down the source of this problem. Signed-off-by: Andrew Morton --- 25-akpm/drivers/pci/quirks.c | 4 ++-- 25-akpm/include/asm-generic/vmlinux.lds.h | 2 ++ 25-akpm/include/linux/pci.h | 23 +++++++++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) diff -puN drivers/pci/quirks.c~sort-generic-pci-fixups-after-specific-ones drivers/pci/quirks.c --- 25/drivers/pci/quirks.c~sort-generic-pci-fixups-after-specific-ones 2004-09-26 17:20:57.088736872 -0700 +++ 25-akpm/drivers/pci/quirks.c 2004-09-26 17:20:57.096735656 -0700 @@ -546,7 +546,7 @@ static void __devinit quirk_cardbus_lega return; pci_write_config_dword(dev, PCI_CB_LEGACY_MODE_BASE, 0); } -DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy ); +DECLARE_PCI_FIXUP_FINAL_ALL(quirk_cardbus_legacy); /* * Following the PCI ordering rules is optional on the AMD762. I'm not @@ -664,7 +664,7 @@ static void __devinit quirk_ide_bases(st printk(KERN_INFO "PCI: Ignoring BAR%d-%d of IDE controller %s\n", first_bar, last_bar, pci_name(dev)); } -DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_ide_bases ); +DECLARE_PCI_FIXUP_HEADER_ALL(quirk_ide_bases); /* * Ensure C0 rev restreaming is off. This is normally done by diff -puN include/asm-generic/vmlinux.lds.h~sort-generic-pci-fixups-after-specific-ones include/asm-generic/vmlinux.lds.h --- 25/include/asm-generic/vmlinux.lds.h~sort-generic-pci-fixups-after-specific-ones 2004-09-26 17:20:57.089736720 -0700 +++ 25-akpm/include/asm-generic/vmlinux.lds.h 2004-09-26 17:20:57.096735656 -0700 @@ -20,9 +20,11 @@ .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \ *(.pci_fixup_header) \ + *(.pci_fixup_header_all) \ VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \ *(.pci_fixup_final) \ + *(.pci_fixup_final_all) \ VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ *(.pci_fixup_enable) \ diff -puN include/linux/pci.h~sort-generic-pci-fixups-after-specific-ones include/linux/pci.h --- 25/include/linux/pci.h~sort-generic-pci-fixups-after-specific-ones 2004-09-26 17:20:57.091736416 -0700 +++ 25-akpm/include/linux/pci.h 2004-09-26 17:20:57.098735352 -0700 @@ -1015,15 +1015,22 @@ enum pci_fixup_pass { }; /* Anonymous variables would be nice... */ -#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ - static struct pci_fixup __pci_fixup_##vendor##device##hook __attribute_used__ \ - __attribute__((__section__(".pci_fixup_header"))) = { \ - vendor, device, hook }; - -#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ - static struct pci_fixup __pci_fixup_##vendor##device##hook __attribute_used__ \ - __attribute__((__section__(".pci_fixup_final"))) = { \ +#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ + static struct pci_fixup __pci_fixup_##name \ + __attribute_used__ __attribute__((__section__( #section ))) = { \ vendor, device, hook }; +#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ + DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ + vendor##device##hook, vendor, device, hook) +#define DECLARE_PCI_FIXUP_HEADER_ALL(hook) \ + DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header_all, \ + ALL_DEVICES##hook, PCI_ANY_ID, PCI_ANY_ID, hook) +#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ + DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ + vendor##device##hook, vendor, device, hook) +#define DECLARE_PCI_FIXUP_FINAL_ALL(hook) \ + DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final_all, \ + ALL_DEVICES##hook, PCI_ANY_ID, PCI_ANY_ID, hook) #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ static struct pci_fixup __pci_fixup_##vendor##device##hook __attribute_used__ \ _