Skip to contentSkip to conversation

staging: android: ion checkpatch.pl cleanups

PATCH In review Phong Tran 3 participants 16 messages Aug 12, 2014 – Aug 13, 2014

Subsystems (2)
lore
Share & tools
lore

Phong Tran

author
#0 lore raw

Hi Greg,

These patches fix checkpatch warning.
Apply for staging-next branch.

Regards,
Phong.

author
#1 lore raw

PATCH 1/5 staging: android: ion: ion.c Fix checkpatch warning

This patch fix the coding style

- Add a new line after variable declaration
- Remove return of void fuction

Tested by compilation

---
 drivers/staging/android/ion/ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion.c +1 -1
index 2703609..56604f4 100644
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
 						client, &debug_client_fops);
 	if (!client->debug_root) {
 		char buf[256], *path;
+
 		path = dentry_path(dev->clients_debug_root, buf, 256);
 		pr_err("Failed to create client debugfs at %s/%s\n",
 			path, client->display_name);
@@ -1056,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
 			       void *ptr)
 {
-	return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
Signature · 1 line
1.9.3
maintainer
#2 lore raw

RFC PATCH 1/1 checkpatch: Warn on patch subjects with "checkpatch"

I think patch subject lines with "checkpatch" in
them are almost never really useful.

Maybe a new checkpatch test to see if a subject line is perhaps less than informational should be added.

Something like:

---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/checkpatch.pl +7 -0
index 31a731e..a690515 100755
@@ -2048,6 +2048,13 @@ sub process {
 			$in_commit_log = 0;
 		}
 
+# Check patch subject lines for "checkpatch" (but not checkpatch:)
+		if ($in_header_lines &&
+		    $line =~ /^\s*subject:.*\bcheckpatch(?!(?:\.pl)?:)\b/i) {
+			WARN("BAD_PATCH_SUBJECT",
+			     "Patch subjects with 'checkpatch' are not generally useful.  Describe the change, not the tool that suggests the change.\n" . $herecurr);
+		}
+
 # Check signature styles
 		if (!$in_header_lines &&
 		    $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
#3 lore raw

Re: [RFC PATCH] checkpatch: Warn on patch subjects with "checkpatch"

The subject will just get changed to "Coding style".

regards,
dan carpenter

author
#4 lore raw

PATCH 2/5 staging: android: ion: ion_chunk_heap.c Fix checkpatch warning

In reply to Phong Tran

This patch fix coding style

- Remove return of void function

Tested by compilation

---
 drivers/staging/android/ion/ion_chunk_heap.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/android/ion/ion_chunk_heap.c +0 -1
index 9c3e49a..3e6ec2e 100644
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 				     struct ion_buffer *buffer)
 {
-	return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
Signature · 1 line
1.9.3
author
#5 lore raw

PATCH 3/5 staging: android: ion: ion_system_heap.c Fix checkpatch warning

In reply to Phong Tran

This patch fix coding rule

- Remove return of void function

Tested by compilation

---
 drivers/staging/android/ion/ion_system_heap.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/android/ion/ion_system_heap.c +0 -1
index 6b77c51..da2a63c 100644
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
 				      struct ion_buffer *buffer)
 {
-	return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
Signature · 1 line
1.9.3
#6 lore raw

Re: [PATCH 3/5] staging: android: ion: ion_system_heap.c Fix checkpatch warning

Just fold all these "- return;" patches into one patch.

regards,
dan carpenter

author
#7 lore raw

PATCH 4/5 staging: android: ion: ion_carveout_heap.c Fix checkpatch warning

In reply to Phong Tran

This patch fix coding style

- Remove return of void function

Tested by compilation

---
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/android/ion/ion_carveout_heap.c +0 -1
index dcb6f21..9156d82 100644
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
 					struct ion_buffer *buffer)
 {
-	return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
Signature · 1 line
1.9.3
author
#8 lore raw

PATCH 5/5 staging: android: ion: ion_dummy_driver.c Fix checkpatch warning

In reply to Phong Tran

This patch fix coding style

- Replace kzalloc() by kcalloc()
- Remove return of void function

Tested by compilation

---
 drivers/staging/android/ion/ion_dummy_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/android/ion/ion_dummy_driver.c +1 -3
index 3a45e79..f3ea1c3 100644
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
 	int i, err;
 
 	idev = ion_device_create(NULL);
-	heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+	heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
 			GFP_KERNEL);
 	if (!heaps)
 		return -ENOMEM;
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
 				dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
 		chunk_ptr = NULL;
 	}
-
-	return;
 }
 __exitcall(ion_dummy_exit);
Signature · 1 line
1.9.3
author
#9 lore raw

PATCH v2 1/3 staging: android: ion: ion_dummy_driver.c Fix coding style

In reply to Phong Tran

This patch fix checkpatch.pl warning
- Replace kzalloc() by kcalloc()
Tested by compilation.

---
 drivers/staging/android/ion/ion_dummy_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion_dummy_driver.c +1 -1
index 3a45e79..6d0a38a 100644
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
 	int i, err;
 
 	idev = ion_device_create(NULL);
-	heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+	heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
 			GFP_KERNEL);
 	if (!heaps)
 		return -ENOMEM;
Signature · 1 line
1.9.3
author
#10 lore raw

PATCH v2 2/3 staging: android: ion: ion.c Fix coding style

This patch fix checkpatch.pl warning
- Add a new line after decleration
Tested by compilation.

---
 drivers/staging/android/ion/ion.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/android/ion/ion.c +1 -0
index 2703609..cad76ae 100644
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
 						client, &debug_client_fops);
 	if (!client->debug_root) {
 		char buf[256], *path;
+
 		path = dentry_path(dev->clients_debug_root, buf, 256);
 		pr_err("Failed to create client debugfs at %s/%s\n",
 			path, client->display_name);
Signature · 1 line
1.9.3
author
#11 lore raw

PATCH v2 3/3 staging: android: ion: Fix coding style

In reply to Phong Tran

This patch fix checkpatch.pl warning
- Remove the return of void function
Tested by compilation.

---
 drivers/staging/android/ion/ion.c               | 1 -
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 drivers/staging/android/ion/ion_chunk_heap.c    | 1 -
 drivers/staging/android/ion/ion_dummy_driver.c  | 2 --
 drivers/staging/android/ion/ion_system_heap.c   | 1 -
 5 files changed, 6 deletions(-)
drivers/staging/android/ion/ion.c +0 -1
index cad76ae..56604f4 100644
@@ -1057,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
 			       void *ptr)
 {
-	return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
drivers/staging/android/ion/ion_carveout_heap.c +0 -1
index dcb6f21..9156d82 100644
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
 					struct ion_buffer *buffer)
 {
-	return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
drivers/staging/android/ion/ion_chunk_heap.c +0 -1
index 9c3e49a..3e6ec2e 100644
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 				     struct ion_buffer *buffer)
 {
-	return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
drivers/staging/android/ion/ion_dummy_driver.c +0 -2
index 6d0a38a..f3ea1c3 100644
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
 				dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
 		chunk_ptr = NULL;
 	}
-
-	return;
 }
 __exitcall(ion_dummy_exit);
drivers/staging/android/ion/ion_system_heap.c +0 -1
index 6b77c51..da2a63c 100644
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
 				      struct ion_buffer *buffer)
 {
-	return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
Signature · 1 line
1.9.3
#12 lore raw

Re: [Patch V2 1/3] staging: android: ion: ion_dummy_driver.c Fix coding style

In reply to Phong Tran
Quoted 4 lines · Phong Tran

This patch fix checkpatch.pl warning
- Replace kzalloc() by kcalloc()
Tested by compilation.

The patches look ok, but can you resend with better subject lines? kzalloc() -> kcalloc().
add blank.
remove returns.

Something like that.

regards,
dan carpenter

author
#13 lore raw

PATCH v3 1/3 staging: android: ion: ion_dummy_driver.c Replace kzalloc() by kcalloc()

In reply to Phong Tran

This patch fix checkpatch.pl warning
Tested by compilation only.

---
 drivers/staging/android/ion/ion_dummy_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion_dummy_driver.c +1 -1
index 3a45e79..6d0a38a 100644
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
 	int i, err;
 
 	idev = ion_device_create(NULL);
-	heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+	heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
 			GFP_KERNEL);
 	if (!heaps)
 		return -ENOMEM;
Signature · 1 line
1.9.3
author
#14 lore raw

PATCH v3 2/3 staging: android: ion: ion.c Add a new blank line after decleration

This patch fix checkpatch.pl warning
Tested by compilation only.

---
 drivers/staging/android/ion/ion.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/android/ion/ion.c +1 -0
index 2703609..cad76ae 100644
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
 						client, &debug_client_fops);
 	if (!client->debug_root) {
 		char buf[256], *path;
+
 		path = dentry_path(dev->clients_debug_root, buf, 256);
 		pr_err("Failed to create client debugfs at %s/%s\n",
 			path, client->display_name);
Signature · 1 line
1.9.3
author
#15 lore raw

PATCH v3 3/3 staging: android: ion: Remove redundant return of void function

In reply to Phong Tran

This patch fix checkpatch.pl warning
Tested by compilation only.

---
 drivers/staging/android/ion/ion.c               | 1 -
 drivers/staging/android/ion/ion_carveout_heap.c | 1 -
 drivers/staging/android/ion/ion_chunk_heap.c    | 1 -
 drivers/staging/android/ion/ion_dummy_driver.c  | 2 --
 drivers/staging/android/ion/ion_system_heap.c   | 1 -
 5 files changed, 6 deletions(-)
drivers/staging/android/ion/ion.c +0 -1
index cad76ae..56604f4 100644
@@ -1057,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, unsigned long offset)
 static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
 			       void *ptr)
 {
-	return;
 }
 
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
drivers/staging/android/ion/ion_carveout_heap.c +0 -1
index dcb6f21..9156d82 100644
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap,
 static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
 					struct ion_buffer *buffer)
 {
-	return;
 }
 
 static struct ion_heap_ops carveout_heap_ops = {
drivers/staging/android/ion/ion_chunk_heap.c +0 -1
index 9c3e49a..3e6ec2e 100644
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct ion_heap *heap,
 static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
 				     struct ion_buffer *buffer)
 {
-	return;
 }
 
 static struct ion_heap_ops chunk_heap_ops = {
drivers/staging/android/ion/ion_dummy_driver.c +0 -2
index 6d0a38a..f3ea1c3 100644
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
 				dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
 		chunk_ptr = NULL;
 	}
-
-	return;
 }
 __exitcall(ion_dummy_exit);
drivers/staging/android/ion/ion_system_heap.c +0 -1
index 6b77c51..da2a63c 100644
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct ion_heap *heap,
 static void ion_system_heap_unmap_dma(struct ion_heap *heap,
 				      struct ion_buffer *buffer)
 {
-	return;
 }
 
 static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
Signature · 1 line
1.9.3