Linux-parisc archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] parisc: Use proper printk format for resource_size_t
@ 2020-01-03 16:39 Krzysztof Kozlowski
  2020-01-14  8:27 ` Helge Deller
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-01-03 16:39 UTC (permalink / raw)
  To: James E.J. Bottomley, Helge Deller, linux-parisc, linux-kernel
  Cc: Krzysztof Kozlowski

resource_size_t should be printed with its own size-independent format
to fix warnings when compiling on 64-bit platform (e.g. with
COMPILE_TEST):

    arch/parisc/kernel/drivers.c: In function 'print_parisc_device':
    arch/parisc/kernel/drivers.c:892:9: warning:
        format '%p' expects argument of type 'void *',
        but argument 4 has type 'resource_size_t {aka unsigned int}' [-Wformat=]

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/parisc/kernel/drivers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index a6c9f49c6612..a154de424421 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)
 	static int count;
 
 	print_pa_hwpath(dev, hw_path);
-	pr_info("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
-		++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type,
+	pr_info("%d. %s at %pa[p] [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
+		++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type,
 		dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);
 
 	if (dev->num_addrs) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] parisc: Use proper printk format for resource_size_t
  2020-01-03 16:39 [PATCH] parisc: Use proper printk format for resource_size_t Krzysztof Kozlowski
@ 2020-01-14  8:27 ` Helge Deller
  2020-01-14  8:53   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2020-01-14  8:27 UTC (permalink / raw)
  To: Krzysztof Kozlowski, James E.J. Bottomley, linux-parisc, linux-kernel

On 03.01.20 17:39, Krzysztof Kozlowski wrote:
> resource_size_t should be printed with its own size-independent format
> to fix warnings when compiling on 64-bit platform (e.g. with
> COMPILE_TEST):
>
>     arch/parisc/kernel/drivers.c: In function 'print_parisc_device':
>     arch/parisc/kernel/drivers.c:892:9: warning:
>         format '%p' expects argument of type 'void *',
>         but argument 4 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  arch/parisc/kernel/drivers.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
> index a6c9f49c6612..a154de424421 100644
> --- a/arch/parisc/kernel/drivers.c
> +++ b/arch/parisc/kernel/drivers.c
> @@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)
>  	static int count;
>
>  	print_pa_hwpath(dev, hw_path);
> -	pr_info("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
> -		++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type,
> +	pr_info("%d. %s at %pa[p] [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",

It needs to be    %pap   instead of   %pa[p].
The documentation in Documentation/core-api/printk-formats.rst is correct, but misleading.
I corrected & applied it.
Thanks!


Helge


> +		++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type,
>  		dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);
>
>  	if (dev->num_addrs) {
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] parisc: Use proper printk format for resource_size_t
  2020-01-14  8:27 ` Helge Deller
@ 2020-01-14  8:53   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-01-14  8:53 UTC (permalink / raw)
  To: Helge Deller; +Cc: James E.J. Bottomley, linux-parisc, linux-kernel

On Tue, Jan 14, 2020 at 09:27:35AM +0100, Helge Deller wrote:
> On 03.01.20 17:39, Krzysztof Kozlowski wrote:
> > resource_size_t should be printed with its own size-independent format
> > to fix warnings when compiling on 64-bit platform (e.g. with
> > COMPILE_TEST):
> >
> >     arch/parisc/kernel/drivers.c: In function 'print_parisc_device':
> >     arch/parisc/kernel/drivers.c:892:9: warning:
> >         format '%p' expects argument of type 'void *',
> >         but argument 4 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
> >
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > ---
> >  arch/parisc/kernel/drivers.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
> > index a6c9f49c6612..a154de424421 100644
> > --- a/arch/parisc/kernel/drivers.c
> > +++ b/arch/parisc/kernel/drivers.c
> > @@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)
> >  	static int count;
> >
> >  	print_pa_hwpath(dev, hw_path);
> > -	pr_info("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
> > -		++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type,
> > +	pr_info("%d. %s at %pa[p] [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }",
> 
> It needs to be    %pap   instead of   %pa[p].
> The documentation in Documentation/core-api/printk-formats.rst is correct, but misleading.
> I corrected & applied it.
> Thanks!

Damn it, you're right. Thanks for noticing!

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03 16:39 [PATCH] parisc: Use proper printk format for resource_size_t Krzysztof Kozlowski
2020-01-14  8:27 ` Helge Deller
2020-01-14  8:53   ` Krzysztof Kozlowski

Linux-parisc archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-parisc/0 linux-parisc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-parisc linux-parisc/ https://lore.kernel.org/linux-parisc \
		linux-parisc@vger.kernel.org
	public-inbox-index linux-parisc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-parisc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git