From: Myron Stowe <myron.stowe@redhat.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, rth@twiddle.net,
ink@jurassic.park.msu.ru, mattst88@gmail.com,
ralf@linux-mips.org, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, yinghai@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH -v2 1/8] PCI: Restructure 'pci_do_fixups()'
Date: Mon, 09 Jul 2012 15:36:02 -0600 [thread overview]
Message-ID: <20120709213602.8975.58935.stgit@amt.stowe> (raw)
In-Reply-To: <20120709213554.8975.60552.stgit@amt.stowe>
It's a bit ugly that we have two possible call sites for the quirk: either
inside do_one_fixup_debug() or directly in pci_do_fixups().
This patch restructures pci_do_fixups()'s quirk invocations in the style
of initcall_debug_start() and initcall_debug_report().
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
---
drivers/pci/quirks.c | 46 ++++++++++++++++++++++++++++++----------------
1 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 194b243..0f5ca86 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);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata);
-static void do_one_fixup_debug(void (*fn)(struct pci_dev *dev), struct pci_dev *dev)
+static ktime_t fixup_debug_start(struct pci_dev *dev,
+ void (*fn)(struct pci_dev *dev))
{
- ktime_t calltime, delta, rettime;
+ ktime_t calltime = ktime_set(0, 0);
+
+ dev_dbg(&dev->dev, "calling %pF\n", fn);
+ if (initcall_debug) {
+ pr_debug("calling %pF @ %i for %s\n",
+ fn, task_pid_nr(current), dev_name(&dev->dev));
+ calltime = ktime_get();
+ }
+
+ return calltime;
+}
+
+static void fixup_debug_report(struct pci_dev *dev, ktime_t calltime,
+ void (*fn)(struct pci_dev *dev))
+{
+ ktime_t delta, rettime;
unsigned long long duration;
- printk(KERN_DEBUG "calling %pF @ %i for %s\n",
- fn, task_pid_nr(current), dev_name(&dev->dev));
- calltime = ktime_get();
- fn(dev);
- rettime = ktime_get();
- delta = ktime_sub(rettime, calltime);
- duration = (unsigned long long) ktime_to_ns(delta) >> 10;
- printk(KERN_DEBUG "pci fixup %pF returned after %lld usecs for %s\n",
- fn, duration, dev_name(&dev->dev));
+ if (initcall_debug) {
+ rettime = ktime_get();
+ delta = ktime_sub(rettime, calltime);
+ duration = (unsigned long long) ktime_to_ns(delta) >> 10;
+ pr_debug("pci fixup %pF returned after %lld usecs for %s\n",
+ fn, duration, dev_name(&dev->dev));
+ }
}
/*
@@ -2958,6 +2972,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1c2d, asus_ehci_no_d3);
static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
struct pci_fixup *end)
{
+ ktime_t calltime;
+
for (; f < end; f++)
if ((f->class == (u32) (dev->class >> f->class_shift) ||
f->class == (u32) PCI_ANY_ID) &&
@@ -2965,11 +2981,9 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
f->vendor == (u16) PCI_ANY_ID) &&
(f->device == dev->device ||
f->device == (u16) PCI_ANY_ID)) {
- dev_dbg(&dev->dev, "calling %pF\n", f->hook);
- if (initcall_debug)
- do_one_fixup_debug(f->hook, dev);
- else
- f->hook(dev);
+ calltime = fixup_debug_start(dev, f->hook);
+ f->hook(dev);
+ fixup_debug_report(dev, calltime, f->hook);
}
}
next prev parent reply other threads:[~2012-07-09 21:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 21:35 [PATCH -v2 0/8] PCI: Add 'pci_fixup_final' quirks into hot-plug paths Myron Stowe
2012-07-09 21:36 ` Myron Stowe [this message]
2012-07-09 21:36 ` [PATCH -v2 2/8] PCI: release temporary reference in __nv_msi_ht_cap_quirk() Myron Stowe
2012-07-09 21:36 ` [PATCH -v2 3/8] PCI: Adjust section annotations of various quirks Myron Stowe
2012-07-09 21:36 ` [PATCH -v2 4/8] alpha/PCI: Move final fixup quirks from __init to __devinit Myron Stowe
2012-07-09 21:36 ` [PATCH -v2 5/8] MIPS/PCI: " Myron Stowe
2012-07-09 21:36 ` [PATCH -v2 6/8] x86/PCI: " Myron Stowe
2012-07-09 21:36 ` [PATCH -v2 7/8] PCI: " Myron Stowe
2012-07-09 21:36 ` [PATCH -v2 8/8] PCI: Integrate 'pci_fixup_final' quirks into hot-plug paths Myron Stowe
2012-07-10 3:22 ` [PATCH -v2 0/8] PCI: Add " Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120709213602.8975.58935.stgit@amt.stowe \
--to=myron.stowe@redhat.com \
--cc=bhelgaas@google.com \
--cc=hpa@zytor.com \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mattst88@gmail.com \
--cc=mingo@redhat.com \
--cc=ralf@linux-mips.org \
--cc=rth@twiddle.net \
--cc=tglx@linutronix.de \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).