]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PCI: fix undefined reference to 'pci_fixup_final_inited'
authorMyron Stowe <myron.stowe@redhat.com>
Fri, 13 Jul 2012 20:29:00 +0000 (14:29 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 16 Jul 2012 15:14:49 +0000 (09:14 -0600)
My "PCI: Integrate 'pci_fixup_final' quirks into hot-plug paths" patch
introduced an undefined reference to 'pci_fixup_final_inited' when
CONFIG_PCI_QUIRKS is not enabled (on x86_64):
  drivers/built-in.o: In function `pci_bus_add_device':
  (.text+0x4f62): undefined reference to `pci_fixup_final_inited'

This patch removes the external reference ending up with a result closer
to what we ultimately want when the boot path issues described in the
original patch are resolved.

References:
  https://lkml.org/lkml/2012/7/9/542    Original, offending, patch
  https://lkml.org/lkml/2012/7/12/338 Randy's catch

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
drivers/pci/bus.c
drivers/pci/quirks.c

index b511bd4e3f7ccabf048afa88309c4af551977422..4b0970b46e0b813ff2623f16dee6807892b370e7 100644 (file)
@@ -164,10 +164,8 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
 int pci_bus_add_device(struct pci_dev *dev)
 {
        int retval;
-       extern bool pci_fixup_final_inited;
 
-       if (pci_fixup_final_inited)
-               pci_fixup_device(pci_fixup_final, dev);
+       pci_fixup_device(pci_fixup_final, dev);
        retval = device_add(&dev->dev);
        if (retval)
                return retval;
index d8e9a0edf93ca5329ffc67296cb1d981e596995c..2472df8a903fab7e3b61b45fb437e0ad35b949d2 100644 (file)
@@ -2979,6 +2979,7 @@ extern struct pci_fixup __end_pci_fixups_resume_early[];
 extern struct pci_fixup __start_pci_fixups_suspend[];
 extern struct pci_fixup __end_pci_fixups_suspend[];
 
+static bool pci_apply_fixup_final_quirks;
 
 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
 {
@@ -2996,6 +2997,8 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
                break;
 
        case pci_fixup_final:
+               if (!pci_apply_fixup_final_quirks)
+                       return;
                start = __start_pci_fixups_final;
                end = __end_pci_fixups_final;
                break;
@@ -3029,21 +3032,6 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
 EXPORT_SYMBOL(pci_fixup_device);
 
 
-/*
- * The global variable 'pci_fixup_final_inited' is being used as a interim
- * solution for calling the final quirks only during hot-plug events (not
- * during boot processing).
- *
- * When the boot path's PCI device setup sequencing is addressed, we can
- * remove the instance, and usages of, 'pci_fixup_final_inited' along with
- * removing 'fs_initcall_sync(pci_apply_final_quirks);' and end up with a
- * single, uniform, solution that satisfies both the boot path and the
- * various hot-plug event paths.
- *
- * ToDo: Remove 'pci_fixup_final_inited'
- */
-bool pci_fixup_final_inited;
-
 static int __init pci_apply_final_quirks(void)
 {
        struct pci_dev *dev = NULL;
@@ -3054,6 +3042,7 @@ static int __init pci_apply_final_quirks(void)
                printk(KERN_DEBUG "PCI: CLS %u bytes\n",
                       pci_cache_line_size << 2);
 
+       pci_apply_fixup_final_quirks = true;
        for_each_pci_dev(dev) {
                pci_fixup_device(pci_fixup_final, dev);
                /*
@@ -3074,7 +3063,6 @@ static int __init pci_apply_final_quirks(void)
                        pci_cache_line_size = pci_dfl_cache_line_size;
                }
        }
-       pci_fixup_final_inited = 1;
 
        if (!pci_cache_line_size) {
                printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",