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 Thu, 10 Aug 2017 19:35:33 +0200
Helge Deller <deller@gmx.de> wrote:

> Sometimes people seems unclear when to use the %pS or %pF printk format.
> Adding some examples may help to avoid such mistakes.
>
> See for example commit 51d96dc2e2dc ("random: fix warning message on ia64 and
> parisc") which fixed such a wrong format string.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
>
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 65ea591..be8c05b 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -73,6 +73,12 @@ actually function descriptors which must first be resolved. The ``F`` and
> ``f`` specifiers perform this resolution and then provide the same
> functionality as the ``S`` and ``s`` specifiers.
>
> +Examples::
> +
> + printk("Called from %pS.\n", __builtin_return_address(0));
> + printk("Called from %pS.\n", (void *)regs->ip);
> + printk("Called from %pF.\n", &gettimeofday);

Is the '&' really necessary? What about using the example:

printk("Called in %pF.\n", __func__);

?

-- Steve

> +
> Kernel Pointers
> ===============
>

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