Commit 95df8b8708a8b381bf276d83c56f7b4e7de04a71

Authored by Myron Stowe
Committed by Bjorn Helgaas
1 parent 735bff10c1

PCI: fix undefined reference to 'pci_fixup_final_inited'

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>

Showing 2 changed files with 5 additions and 19 deletions Side-by-side Diff

... ... @@ -164,10 +164,8 @@
164 164 int pci_bus_add_device(struct pci_dev *dev)
165 165 {
166 166 int retval;
167   - extern bool pci_fixup_final_inited;
168 167  
169   - if (pci_fixup_final_inited)
170   - pci_fixup_device(pci_fixup_final, dev);
  168 + pci_fixup_device(pci_fixup_final, dev);
171 169 retval = device_add(&dev->dev);
172 170 if (retval)
173 171 return retval;
drivers/pci/quirks.c
... ... @@ -2979,6 +2979,7 @@
2979 2979 extern struct pci_fixup __start_pci_fixups_suspend[];
2980 2980 extern struct pci_fixup __end_pci_fixups_suspend[];
2981 2981  
  2982 +static bool pci_apply_fixup_final_quirks;
2982 2983  
2983 2984 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
2984 2985 {
... ... @@ -2996,6 +2997,8 @@
2996 2997 break;
2997 2998  
2998 2999 case pci_fixup_final:
  3000 + if (!pci_apply_fixup_final_quirks)
  3001 + return;
2999 3002 start = __start_pci_fixups_final;
3000 3003 end = __end_pci_fixups_final;
3001 3004 break;
... ... @@ -3029,21 +3032,6 @@
3029 3032 EXPORT_SYMBOL(pci_fixup_device);
3030 3033  
3031 3034  
3032   -/*
3033   - * The global variable 'pci_fixup_final_inited' is being used as a interim
3034   - * solution for calling the final quirks only during hot-plug events (not
3035   - * during boot processing).
3036   - *
3037   - * When the boot path's PCI device setup sequencing is addressed, we can
3038   - * remove the instance, and usages of, 'pci_fixup_final_inited' along with
3039   - * removing 'fs_initcall_sync(pci_apply_final_quirks);' and end up with a
3040   - * single, uniform, solution that satisfies both the boot path and the
3041   - * various hot-plug event paths.
3042   - *
3043   - * ToDo: Remove 'pci_fixup_final_inited'
3044   - */
3045   -bool pci_fixup_final_inited;
3046   -
3047 3035 static int __init pci_apply_final_quirks(void)
3048 3036 {
3049 3037 struct pci_dev *dev = NULL;
... ... @@ -3054,6 +3042,7 @@
3054 3042 printk(KERN_DEBUG "PCI: CLS %u bytes\n",
3055 3043 pci_cache_line_size << 2);
3056 3044  
  3045 + pci_apply_fixup_final_quirks = true;
3057 3046 for_each_pci_dev(dev) {
3058 3047 pci_fixup_device(pci_fixup_final, dev);
3059 3048 /*
... ... @@ -3074,7 +3063,6 @@
3074 3063 pci_cache_line_size = pci_dfl_cache_line_size;
3075 3064 }
3076 3065 }
3077   - pci_fixup_final_inited = 1;
3078 3066  
3079 3067 if (!pci_cache_line_size) {
3080 3068 printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",