public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's
@ 2015-04-09 22:31 Mitchel Humpherys
  2015-04-09 22:38 ` Greg Kroah-Hartman
  2015-04-09 22:48 ` Colin Cross
  0 siblings, 2 replies; 5+ messages in thread
From: Mitchel Humpherys @ 2015-04-09 22:31 UTC (permalink / raw)
  To: devel, Greg Kroah-Hartman, Android Kernel Team, Colin Cross,
	John Stultz
  Cc: linux-kernel, Mitchel Humpherys

We're currently using %lu and %ld to print some variables of type
dma_addr_t, which results in the following warning when dma_addr_t is
64-bits wide:

    drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create':
    drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=]
      pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
      ^
    drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=]

Fix this by using %pa as instructed in printk-formats.txt.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
---
 drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c
index 3e6ec2ee6802..f0b7c8e68422 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -173,8 +173,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
 	chunk_heap->heap.ops = &chunk_heap_ops;
 	chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
 	chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
-	pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
-		heap_data->size, heap_data->align);
+	pr_info("%s: base %pa size %zu align %pa\n", __func__,
+		&chunk_heap->base, heap_data->size, &heap_data->align);
 
 	return &chunk_heap->heap;
 
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's
  2015-04-09 22:31 [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's Mitchel Humpherys
@ 2015-04-09 22:38 ` Greg Kroah-Hartman
  2015-04-09 23:19   ` Mitchel Humpherys
  2015-04-09 22:48 ` Colin Cross
  1 sibling, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2015-04-09 22:38 UTC (permalink / raw)
  To: Mitchel Humpherys
  Cc: devel, Android Kernel Team, Colin Cross, John Stultz,
	linux-kernel

On Thu, Apr 09, 2015 at 03:31:14PM -0700, Mitchel Humpherys wrote:
> We're currently using %lu and %ld to print some variables of type
> dma_addr_t, which results in the following warning when dma_addr_t is
> 64-bits wide:
> 
>     drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create':
>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=]
>       pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
>       ^
>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=]
> 
> Fix this by using %pa as instructed in printk-formats.txt.
> 
> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
> ---
>  drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c
> index 3e6ec2ee6802..f0b7c8e68422 100644
> --- a/drivers/staging/android/ion/ion_chunk_heap.c
> +++ b/drivers/staging/android/ion/ion_chunk_heap.c
> @@ -173,8 +173,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
>  	chunk_heap->heap.ops = &chunk_heap_ops;
>  	chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
>  	chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
> -	pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
> -		heap_data->size, heap_data->align);
> +	pr_info("%s: base %pa size %zu align %pa\n", __func__,
> +		&chunk_heap->base, heap_data->size, &heap_data->align);

Shouldn't this be a debug message, and not printed out for everyone to
see all the time?

thanks,

greg k-h

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

* Re: [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's
  2015-04-09 22:31 [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's Mitchel Humpherys
  2015-04-09 22:38 ` Greg Kroah-Hartman
@ 2015-04-09 22:48 ` Colin Cross
  2015-04-09 23:20   ` Mitchel Humpherys
  1 sibling, 1 reply; 5+ messages in thread
From: Colin Cross @ 2015-04-09 22:48 UTC (permalink / raw)
  To: Mitchel Humpherys
  Cc: devel, Greg Kroah-Hartman, Android Kernel Team, John Stultz, lkml

On Thu, Apr 9, 2015 at 3:31 PM, Mitchel Humpherys
<mitchelh@codeaurora.org> wrote:
> We're currently using %lu and %ld to print some variables of type
> dma_addr_t, which results in the following warning when dma_addr_t is
> 64-bits wide:
>
>     drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create':
>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=]
>       pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
>       ^
>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=]
>
> Fix this by using %pa as instructed in printk-formats.txt.

According to printk-formats.txt, dma_addr_t needs to be printed with %pad.

> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
> ---
>  drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c
> index 3e6ec2ee6802..f0b7c8e68422 100644
> --- a/drivers/staging/android/ion/ion_chunk_heap.c
> +++ b/drivers/staging/android/ion/ion_chunk_heap.c
> @@ -173,8 +173,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
>         chunk_heap->heap.ops = &chunk_heap_ops;
>         chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
>         chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
> -       pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
> -               heap_data->size, heap_data->align);
> +       pr_info("%s: base %pa size %zu align %pa\n", __func__,
> +               &chunk_heap->base, heap_data->size, &heap_data->align);
>
>         return &chunk_heap->heap;
>
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.

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

* Re: [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's
  2015-04-09 22:38 ` Greg Kroah-Hartman
@ 2015-04-09 23:19   ` Mitchel Humpherys
  0 siblings, 0 replies; 5+ messages in thread
From: Mitchel Humpherys @ 2015-04-09 23:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Android Kernel Team, Colin Cross, John Stultz,
	linux-kernel

On Thu, Apr 09 2015 at 03:38:39 PM, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> On Thu, Apr 09, 2015 at 03:31:14PM -0700, Mitchel Humpherys wrote:
>> We're currently using %lu and %ld to print some variables of type
>> dma_addr_t, which results in the following warning when dma_addr_t is
>> 64-bits wide:
>> 
>>     drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create':
>>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=]
>>       pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
>>       ^
>>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=]
>> 
>> Fix this by using %pa as instructed in printk-formats.txt.
>> 
>> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
>> ---
>>  drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c
>> index 3e6ec2ee6802..f0b7c8e68422 100644
>> --- a/drivers/staging/android/ion/ion_chunk_heap.c
>> +++ b/drivers/staging/android/ion/ion_chunk_heap.c
>> @@ -173,8 +173,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
>>  	chunk_heap->heap.ops = &chunk_heap_ops;
>>  	chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
>>  	chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
>> -	pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
>> -		heap_data->size, heap_data->align);
>> +	pr_info("%s: base %pa size %zu align %pa\n", __func__,
>> +		&chunk_heap->base, heap_data->size, &heap_data->align);
>
> Shouldn't this be a debug message, and not printed out for everyone to
> see all the time?

Yeah that'd probably be better.  I'll send a patch.


-Mitch

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's
  2015-04-09 22:48 ` Colin Cross
@ 2015-04-09 23:20   ` Mitchel Humpherys
  0 siblings, 0 replies; 5+ messages in thread
From: Mitchel Humpherys @ 2015-04-09 23:20 UTC (permalink / raw)
  To: Colin Cross
  Cc: devel, Greg Kroah-Hartman, Android Kernel Team, John Stultz, lkml

On Thu, Apr 09 2015 at 03:48:55 PM, Colin Cross <ccross@android.com> wrote:
> On Thu, Apr 9, 2015 at 3:31 PM, Mitchel Humpherys
> <mitchelh@codeaurora.org> wrote:
>> We're currently using %lu and %ld to print some variables of type
>> dma_addr_t, which results in the following warning when dma_addr_t is
>> 64-bits wide:
>>
>>     drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create':
>>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=]
>>       pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
>>       ^
>>     drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=]
>>
>> Fix this by using %pa as instructed in printk-formats.txt.
>
> According to printk-formats.txt, dma_addr_t needs to be printed with %pad.

Ah good catch.  I'll send a v2.

I need to check printk-formats.txt more often...  :)


-Mitch

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2015-04-09 23:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-09 22:31 [PATCH] staging: ion: chunk_heap: use %pa for printing dma_addr_t's Mitchel Humpherys
2015-04-09 22:38 ` Greg Kroah-Hartman
2015-04-09 23:19   ` Mitchel Humpherys
2015-04-09 22:48 ` Colin Cross
2015-04-09 23:20   ` Mitchel Humpherys

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox