Skip to contentSkip to conversation

staging: ion: chunk_heap: use pr_debug for heap creation print

PATCH In review Mitchel Humpherys 4 participants 6 messages Apr 10, 2015 – May 8, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 staging: ion: chunk_heap: use pr_debug for heap creation print

We're currently printing to the kernel log at info' level when we successfully create the chunk heap, but success messages should be done at debug' level. Fix this.

---
 drivers/staging/android/ion/ion_chunk_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion_chunk_heap.c +1 -1
index 3e6ec2ee6802..54746157d799 100644
@@ -173,7 +173,7 @@ 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,
+	pr_debug("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
 		heap_data->size, heap_data->align);
 
 	return &chunk_heap->heap;
Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH v2 2/2 staging: ion: chunk_heap: use %pad for printing dma_addr_t's

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 %pad as instructed in printk-formats.txt.

---
 drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion_chunk_heap.c +2 -2
index 54746157d799..6b3e18aa1c64 100644
@@ -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_debug("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
-		heap_data->size, heap_data->align);
+	pr_debug("%s: base %pad size %zu align %pad\n", __func__,
+		&chunk_heap->base, heap_data->size, &heap_data->align);
 
 	return &chunk_heap->heap;
 
Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

Re: [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's

Quoted 10 lines · 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=]

Quoted 3 lines

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

This one was just merged and I was about to email you that it introduces some new Smatch warnings, but actually looking at it, it's just wrong.

We want to print "chunk_heap->base" and not "&chunk_heap->base".

And anyway "&chunk_heap->base" is a regular pointer, not a dma_addr_t.

So please send a new patch that removes the &.

regards,
dan carpenter

Quoted 28 lines
---
 drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion_chunk_heap.c +2 -2
index 54746157d799..6b3e18aa1c64 100644
@@ -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_debug("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
-		heap_data->size, heap_data->align);
+	pr_debug("%s: base %pad size %zu align %pad\n", __func__,
+		&chunk_heap->base, heap_data->size, &heap_data->align);
 
 	return &chunk_heap->heap;
 
Signature · 8 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#3 lore raw

Re: [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's

Quoted 11 lines · Dan Carpenter
Quoted 10 lines · 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=]

Quoted 8 lines
Quoted 3 lines

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

This one was just merged and I was about to email you that it introduces some new Smatch warnings, but actually looking at it, it's just wrong.

We want to print "chunk_heap->base" and not "&chunk_heap->base".

This would be correct if base was a dma_addr_t...

Quoted 1 line

And anyway "&chunk_heap->base" is a regular pointer, not a dma_addr_t.

But it is actually an ion_phys_addr_t, which is currently typedef'd to unsigned long. Are you using a local patch that replaces ion_phys_addr_t with dma_addr_t?

Quoted 1 line

So please send a new patch that removes the &.

Removing the & is not correct, lib/vsprintf.c will dereference the arg for %pad or %pap. I think this patch should just be dropped, the old %lu was correct for what is in Linus' tree.

Quoted 27 lines

regards,
dan carpenter

Quoted 24 lines
---
 drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion_chunk_heap.c +2 -3
index 54746157d799..6b3e18aa1c64 100644
@@ -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_debug("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
-             heap_data->size, heap_data->align);
+     pr_debug("%s: base %pad size %zu align %pad\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

Quoted 6 lines
Quoted 4 lines

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

+

#4 lore raw

Re: [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's

Quoted 29 lines · Colin Cross
Quoted 11 lines · Dan Carpenter
Quoted 10 lines · 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=]

Quoted 8 lines
Quoted 3 lines

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

This one was just merged and I was about to email you that it introduces some new Smatch warnings, but actually looking at it, it's just wrong.

We want to print "chunk_heap->base" and not "&chunk_heap->base".

This would be correct if base was a dma_addr_t...

Quoted 1 line

And anyway "&chunk_heap->base" is a regular pointer, not a dma_addr_t.

But it is actually an ion_phys_addr_t, which is currently typedef'd to unsigned long. Are you using a local patch that replaces ion_phys_addr_t with dma_addr_t?

Quoted 5 lines
Quoted 1 line

So please send a new patch that removes the &.

Removing the & is not correct, lib/vsprintf.c will dereference the arg for %pad or %pap. I think this patch should just be dropped, the old %lu was correct for what is in Linus' tree.

Ah, you're absolutely correct. We have a local patch that makes ion_phys_addr_t a dma_addr_t (needed for LPAE), which is why I needed to convert the printk format...

Greg, can you please drop this patch from your tree? We'll only need this if/when mainline Ion gets LPAE support...

-Mitch

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#5 lore raw

Re: [PATCH v2 2/2] staging: ion: chunk_heap: use %pad for printing dma_addr_t's

Quoted 36 lines · Mitchel Humpherys
Quoted 29 lines · Colin Cross
Quoted 11 lines · Dan Carpenter
Quoted 10 lines · 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=]

Quoted 8 lines
Quoted 3 lines

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

This one was just merged and I was about to email you that it introduces some new Smatch warnings, but actually looking at it, it's just wrong.

We want to print "chunk_heap->base" and not "&chunk_heap->base".

This would be correct if base was a dma_addr_t...

Quoted 1 line

And anyway "&chunk_heap->base" is a regular pointer, not a dma_addr_t.

But it is actually an ion_phys_addr_t, which is currently typedef'd to unsigned long. Are you using a local patch that replaces ion_phys_addr_t with dma_addr_t?

Quoted 5 lines
Quoted 1 line

So please send a new patch that removes the &.

Removing the & is not correct, lib/vsprintf.c will dereference the arg for %pad or %pap. I think this patch should just be dropped, the old %lu was correct for what is in Linus' tree.

Quoted 6 lines

Ah, you're absolutely correct. We have a local patch that makes ion_phys_addr_t a dma_addr_t (needed for LPAE), which is why I needed to convert the printk format...

Greg, can you please drop this patch from your tree? We'll only need this if/when mainline Ion gets LPAE support...

Now dropped, thanks.

greg k-h