aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorMyron Stowe <myron.stowe@redhat.com>2012-07-09 17:36:02 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-07-09 18:41:13 -0400
commit2729d5b18df363167d0c0be428876f3c07d2617b (patch)
treea95c2c853241db5e86ab1621e94341c2aba7260a /drivers/pci
parentcfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff)
PCI: restructure 'pci_do_fixups()'
This patch restructures pci_do_fixups()'s quirk invocations in the style of initcall_debug_start() and initcall_debug_report(), so we have only one call site for the quirk. [bhelgaas: changelog] Signed-off-by: Myron Stowe <myron.stowe@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/quirks.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 2a7521677541..51c4a4409e8c 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2879,20 +2879,34 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata);
2879DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); 2879DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata);
2880 2880
2881 2881
2882static void do_one_fixup_debug(void (*fn)(struct pci_dev *dev), struct pci_dev *dev) 2882static ktime_t fixup_debug_start(struct pci_dev *dev,
2883 void (*fn)(struct pci_dev *dev))
2883{ 2884{
2884 ktime_t calltime, delta, rettime; 2885 ktime_t calltime = ktime_set(0, 0);
2886
2887 dev_dbg(&dev->dev, "calling %pF\n", fn);
2888 if (initcall_debug) {
2889 pr_debug("calling %pF @ %i for %s\n",
2890 fn, task_pid_nr(current), dev_name(&dev->dev));
2891 calltime = ktime_get();
2892 }
2893
2894 return calltime;
2895}
2896
2897static void fixup_debug_report(struct pci_dev *dev, ktime_t calltime,
2898 void (*fn)(struct pci_dev *dev))
2899{
2900 ktime_t delta, rettime;
2885 unsigned long long duration; 2901 unsigned long long duration;
2886 2902
2887 printk(KERN_DEBUG "calling %pF @ %i for %s\n", 2903 if (initcall_debug) {
2888 fn, task_pid_nr(current), dev_name(&dev->dev)); 2904 rettime = ktime_get();
2889 calltime = ktime_get(); 2905 delta = ktime_sub(rettime, calltime);
2890 fn(dev); 2906 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
2891 rettime = ktime_get(); 2907 pr_debug("pci fixup %pF returned after %lld usecs for %s\n",
2892 delta = ktime_sub(rettime, calltime); 2908 fn, duration, dev_name(&dev->dev));
2893 duration = (unsigned long long) ktime_to_ns(delta) >> 10; 2909 }
2894 printk(KERN_DEBUG "pci fixup %pF returned after %lld usecs for %s\n",
2895 fn, duration, dev_name(&dev->dev));
2896} 2910}
2897 2911
2898/* 2912/*
@@ -2932,6 +2946,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
2932static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, 2946static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
2933 struct pci_fixup *end) 2947 struct pci_fixup *end)
2934{ 2948{
2949 ktime_t calltime;
2950
2935 for (; f < end; f++) 2951 for (; f < end; f++)
2936 if ((f->class == (u32) (dev->class >> f->class_shift) || 2952 if ((f->class == (u32) (dev->class >> f->class_shift) ||
2937 f->class == (u32) PCI_ANY_ID) && 2953 f->class == (u32) PCI_ANY_ID) &&
@@ -2939,11 +2955,9 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
2939 f->vendor == (u16) PCI_ANY_ID) && 2955 f->vendor == (u16) PCI_ANY_ID) &&
2940 (f->device == dev->device || 2956 (f->device == dev->device ||
2941 f->device == (u16) PCI_ANY_ID)) { 2957 f->device == (u16) PCI_ANY_ID)) {
2942 dev_dbg(&dev->dev, "calling %pF\n", f->hook); 2958 calltime = fixup_debug_start(dev, f->hook);
2943 if (initcall_debug) 2959 f->hook(dev);
2944 do_one_fixup_debug(f->hook, dev); 2960 fixup_debug_report(dev, calltime, f->hook);
2945 else
2946 f->hook(dev);
2947 } 2961 }
2948} 2962}
2949 2963