From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Kyle McMartin <kyle@mcmartin.ca>,
Matthew Wilcox <matthew@wil.cx>,
Grant Grundler <grundler@parisc-linux.org>,
linux-parisc@vger.kernel.org,
Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: [patch] vsprintf: use new vsprintf symbolic function pointer format
Date: Fri, 22 Aug 2008 09:34:43 -0600 [thread overview]
Message-ID: <200808220934.44782.bjorn.helgaas@hp.com> (raw)
Use the '%pF' format to get rid of an "#ifdef DEBUG" and make
some printks atomic.
This removes the last in-tree uses of print_fn_descriptor_symbol().
I marked print_fn_descriptor_symbol() deprecated and scheduled it
for removal next year to give time for out-of-tree modules to be
updated.
I cc'd the parisc folks because print_fn_descriptor_symbol() is
currently broken there (it needs to dereference the function pointer
similar to ia64 and power). This patch shouldn't make anything worse,
but it means we need to fix dereference_function_descriptor() instead
of print_fn_descriptor_symbol() to get meaningful initcall_debug
output.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
Documentation/feature-removal-schedule.txt | 8 ++++++++
drivers/base/power/main.c | 7 ++-----
drivers/pci/quirks.c | 5 +----
include/linux/kallsyms.h | 8 +++-----
init/main.c | 14 ++++++--------
5 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index eb1a47b..6951fb4 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -322,3 +322,11 @@ Why: Accounting can now be enabled/disabled without kernel recompilation.
controlled by a kernel/module/sysfs/sysctl parameter.
Who: Krzysztof Piotr Oledzki <ole@ans.pl>
+---------------------------
+
+What: print_fn_descriptor_symbol()
+When: October 2009
+Why: The %pF vsprintf format provides the same functionality in a
+ simpler way. print_fn_descriptor_symbol() is deprecated but
+ still present to give out-of-tree modules time to change.
+Who: Bjorn Helgaas <bjorn.helgaas@hp.com>
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 3250c52..cd12708 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -787,10 +787,7 @@ EXPORT_SYMBOL_GPL(device_suspend);
void __suspend_report_result(const char *function, void *fn, int ret)
{
- if (ret) {
- printk(KERN_ERR "%s(): ", function);
- print_fn_descriptor_symbol("%s returns ", fn);
- printk("%d\n", ret);
- }
+ if (ret)
+ printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
}
EXPORT_SYMBOL_GPL(__suspend_report_result);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 9236e7f..0143268 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1560,10 +1560,7 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_f
while (f < end) {
if ((f->vendor == dev->vendor || f->vendor == (u16) PCI_ANY_ID) &&
(f->device == dev->device || f->device == (u16) PCI_ANY_ID)) {
-#ifdef DEBUG
- dev_dbg(&dev->dev, "calling ");
- print_fn_descriptor_symbol("%s\n", f->hook);
-#endif
+ dev_dbg(&dev->dev, "calling %pF\n", f->hook);
f->hook(dev);
}
f++;
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index b961448..f3fe343 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -93,12 +93,10 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
}
/*
- * Pretty-print a function pointer.
- *
- * ia64 and ppc64 function pointers are really function descriptors,
- * which contain a pointer the real address.
+ * Pretty-print a function pointer. This function is deprecated.
+ * Please use the "%pF" vsprintf format instead.
*/
-static inline void print_fn_descriptor_symbol(const char *fmt, void *addr)
+static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr)
{
#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
addr = *(void **)addr;
diff --git a/init/main.c b/init/main.c
index f6f7042..75a038d 100644
--- a/init/main.c
+++ b/init/main.c
@@ -708,7 +708,7 @@ int do_one_initcall(initcall_t fn)
int result;
if (initcall_debug) {
- print_fn_descriptor_symbol("calling %s\n", fn);
+ printk("calling %pF\n", fn);
t0 = ktime_get();
}
@@ -718,9 +718,8 @@ int do_one_initcall(initcall_t fn)
t1 = ktime_get();
delta = ktime_sub(t1, t0);
- print_fn_descriptor_symbol("initcall %s", fn);
- printk(" returned %d after %Ld msecs\n", result,
- (unsigned long long) delta.tv64 >> 20);
+ printk("initcall %pF returned %d after %Ld msecs\n", fn,
+ result, (unsigned long long) delta.tv64 >> 20);
}
msgbuf[0] = 0;
@@ -736,10 +735,9 @@ int do_one_initcall(initcall_t fn)
strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
local_irq_enable();
}
- if (msgbuf[0]) {
- print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
- printk(" returned with %s\n", msgbuf);
- }
+ if (msgbuf[0])
+ printk(KERN_WARNING "initcall %pF returned with %s\n",
+ fn, msgbuf);
return result;
}
next reply other threads:[~2008-08-22 15:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 15:34 Bjorn Helgaas [this message]
2008-08-22 16:32 ` Kyle McMartin
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=200808220934.44782.bjorn.helgaas@hp.com \
--to=bjorn.helgaas@hp.com \
--cc=akpm@linux-foundation.org \
--cc=grundler@parisc-linux.org \
--cc=jbarnes@virtuousgeek.org \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=matthew@wil.cx \
/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
all inboxes | Powered by JetHome®