From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751919AbdHKAPK (ORCPT ); Thu, 10 Aug 2017 20:15:10 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:38815 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750841AbdHKAPI (ORCPT ); Thu, 10 Aug 2017 20:15:08 -0400 Date: Fri, 11 Aug 2017 09:15:21 +0900 From: Sergey Senozhatsky To: Helge Deller Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org Subject: Re: [PATCH] printk-formats.txt: Add examples for %pS and %pF Message-ID: <20170811001521.GA520@jagdpanzerIV.localdomain> References: <20170810173533.GA11600@ls3530.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170810173533.GA11600@ls3530.fritz.box> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (08/10/17 19:35), Helge Deller 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 > > 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); sorry, but how does it help? there is this paragraph : On ia64, ppc64 and parisc64 architectures function pointers are : 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. which supposed to explain everything in details. the examples don't make it any `clearer', IMHO. *may be* on "ia64, ppc64 and parisc64" we can somehow check that the pointer, which we pass as %pS, belongs to .text and print some build-time warnings. well, if it's actually a problem. dunno. -ss