lkml.org 
[lkml]   [2017]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] printk-formats.txt: Add examples for %pS and %pF
On Tue, 15 Aug 2017 21:47:27 +0200
Helge Deller <deller@gmx.de> wrote:

> > Very interesting!
> >
> > This code:
> > void smp_cpus_done() {
> > printk("Called from %pF.\n", smp_cpus_done);
> > printk("Called from %pf.\n", smp_cpus_done);
> > printk("Called in %pS.\n", __func__);
> > printk("Called in %ps.\n", __func__);
> > printk("Called in %pF.\n", __func__);
> > printk("Called in %pf.\n", __func__);
> >
> > gives:
> > Called from smp_cpus_done+0x0/0x1b8.
> > Called from smp_cpus_done.
> > Called in __func__.28197+0x0/0x20.
> > Called in __func__.28197.
> > Called in 0x5041524953433332.
> > Called in 0x5041524953433332.
> >
> > So, the correct usage is:
> > printk("Called in %pS.\n", __func__);
>
> I'm wrong.
> The correct usage would be:
> printk("Called in %s.\n", __func__);
>
> __func__ is just a pointer to a string.

OK, I'm still on vacation :-/

Yeah, I was looking for usages of %pF, and came across this:

pr_warn("%s: NULL omap_sr from %pF\n",
__func__, (void *)_RET_IP_);

And not noticing the first "%s" :-p

-- Steve

\
 
 \ /
  Last update: 2017-08-15 23:36    [W:0.339 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site