Skip to contentSkip to conversation

staging: ion: Fix a coding style issue

PATCH Superseded Antti Keränen 2 participants 6 messages Sep 22, 2016 – Sep 23, 2016 1 message not in the archive Staging

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 1/2 staging: ion: Fix a coding style issue

Remove unnecessary braces surrounding a single statement block

---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +2 -2
index 659aa71..bd45151 100644
@@ -82,9 +82,9 @@ static int hi6220_ion_remove(struct platform_device *pdev)
 
 	ipdev = platform_get_drvdata(pdev);
 
-	for (i = 0; i < ipdev->data->nr; i++) {
+	for (i = 0; i < ipdev->data->nr; i++)
 		ion_heap_destroy(ipdev->heaps[i]);
-	}
+
 	ion_destroy_platform_data(ipdev->data);
 	ion_device_destroy(ipdev->idev);
 
Signature · 1 line
2.9.3
#2 lore raw

PATCH v3 2/2 staging: ion: Fix a coding style issue

Correctly align an unaligned block comment

---
 drivers/staging/android/uapi/ion.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/uapi/ion.h +1 -1
index 647f130..e629394 100644
@@ -57,7 +57,7 @@ enum ion_heap_type {
 					 * cached, ion will do cache
 					 * maintenance when the buffer is
 					 * mapped for dma
-					*/
+					 */
 #define ION_FLAG_CACHED_NEEDS_SYNC 2	/*
 					 * mappings of this buffer will created
 					 * at mmap time, if this is set
Signature · 1 line
2.9.3
#3 lore raw
Quoted 13 lines · Antti Keränen

Correctly align an unaligned block comment

---
 drivers/staging/android/uapi/ion.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/uapi/ion.h +0 -0
index 647f130..e629394 100644

drivers/staging/android/uapi/ion.h enum ion_heap_type { · line 63

Quoted 8 lines
drivers/staging/android/uapi/ion.h +1 -1
@@ -57,7 +57,7 @@ enum ion_heap_type {
 					 * cached, ion will do cache
 					 * maintenance when the buffer is
 					 * mapped for dma
-					*/
+					 */
 #define ION_FLAG_CACHED_NEEDS_SYNC 2	/*
 					 * mappings of this buffer will created
 					 * at mmap time, if this is set

I've always hated these comments. Can you fix them to be regular looking right above each #define?

Thanks,
Laura

#4 lore raw

PATCH v4 1/1 staging: ion: Fix a coding style issue

This patch fixes the alignment of an allocation flag block comment and moves the comments before each #define.

---
In addition to fixing the alignment issue, this version of the patch moves the comments from after the define lines to before the define lines.

 drivers/staging/android/uapi/ion.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/android/uapi/ion.h +12 -12
index 647f130..14cd873 100644
@@ -52,18 +52,18 @@ enum ion_heap_type {
  * allocation flags - the lower 16 bits are used by core ion, the upper 16
  * bits are reserved for use by the heaps themselves.
  */
-#define ION_FLAG_CACHED 1		/*
-					 * mappings of this buffer should be
-					 * cached, ion will do cache
-					 * maintenance when the buffer is
-					 * mapped for dma
-					*/
-#define ION_FLAG_CACHED_NEEDS_SYNC 2	/*
-					 * mappings of this buffer will created
-					 * at mmap time, if this is set
-					 * caches must be managed
-					 * manually
-					 */
+
+/*
+ * mappings of this buffer should be cached, ion will do cache maintenance
+ * when the buffer is mapped for dma
+ */
+#define ION_FLAG_CACHED 1
+
+/*
+ * mappings of this buffer will created at mmap time, if this is set
+ * caches must be managed manually
+ */
+#define ION_FLAG_CACHED_NEEDS_SYNC 2
 
 /**
  * DOC: Ion Userspace API
Signature · 1 line
2.9.3
Acked-by on v4 1/1
#5 lore raw
Quoted 3 lines · Antti Keränen

This patch fixes the alignment of an allocation flag block comment and moves the comments before each #define.

Quoted 44 lines

---
In addition to fixing the alignment issue, this version of the patch moves the comments from after the define lines to before the define lines.

 drivers/staging/android/uapi/ion.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/android/uapi/ion.h +12 -12
index 647f130..14cd873 100644
@@ -52,18 +52,18 @@ enum ion_heap_type {
  * allocation flags - the lower 16 bits are used by core ion, the upper 16
  * bits are reserved for use by the heaps themselves.
  */
-#define ION_FLAG_CACHED 1		/*
-					 * mappings of this buffer should be
-					 * cached, ion will do cache
-					 * maintenance when the buffer is
-					 * mapped for dma
-					*/
-#define ION_FLAG_CACHED_NEEDS_SYNC 2	/*
-					 * mappings of this buffer will created
-					 * at mmap time, if this is set
-					 * caches must be managed
-					 * manually
-					 */
+
+/*
+ * mappings of this buffer should be cached, ion will do cache maintenance
+ * when the buffer is mapped for dma
+ */
+#define ION_FLAG_CACHED 1
+
+/*
+ * mappings of this buffer will created at mmap time, if this is set
+ * caches must be managed manually
+ */
+#define ION_FLAG_CACHED_NEEDS_SYNC 2
 
 /**
  * DOC: Ion Userspace API
Acked-by on v3 1/2
#6 lore raw
In reply to Antti Keränen
Quoted 2 lines · Antti Keränen

Remove unnecessary braces surrounding a single statement block

In the future, when sending different versions of a patch please give a short summary of what's changed. I think this is just a resend from v2 with more reviewers added but I'm not 100% sure.

Quoted 2 lines

---

You can put your summary right here between the --- and the diffstat.

Quoted 10 lines
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +0 -0
index 659aa71..bd45151 100644
@@ -82,9 +82,9 @@ static int hi6220_ion_remove(struct platform_device *pdev)
 

drivers/staging/android/ion/hisilicon/hi6220_ion.c static int hi6220_ion_remove(struct platform_device *pdev) · line 90

Quoted 10 lines
drivers/staging/android/ion/hisilicon/hi6220_ion.c +2 -2
 	ipdev = platform_get_drvdata(pdev);
 
-	for (i = 0; i < ipdev->data->nr; i++) {
+	for (i = 0; i < ipdev->data->nr; i++)
 		ion_heap_destroy(ipdev->heaps[i]);
-	}
+
 	ion_destroy_platform_data(ipdev->data);
 	ion_device_destroy(ipdev->idev);
 

The patch looks fine though so assuming nothing else has changed