[PATCHv2 1/5] staging:android:ion: Fix comparison with NULL

2016-09-23 Thread giannis . damigos
From: Yannis Damigos 

This patch fixes the following comparison with NULL issues:

CHECK: Comparison to NULL could be written "compatible[i].name"
+   for (i = 0; compatible[i].name != NULL; i++) {

CHECK: Comparison to NULL could be written "!compatible[i].name"
+   if (compatible[i].name == NULL)

Signed-off-by: Yannis Damigos 
---
 drivers/staging/android/ion/ion_of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index de0899a..b3da8d8 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -31,12 +31,12 @@ int ion_parse_dt_heap_common(struct device_node *heap_node,
 {
int i;
 
-   for (i = 0; compatible[i].name != NULL; i++) {
+   for (i = 0; compatible[i].name; i++) {
if (of_device_is_compatible(heap_node, compatible[i].compat))
break;
}
 
-   if (compatible[i].name == NULL)
+   if (!compatible[i].name)
return -ENODEV;
 
heap->id = compatible[i].heap_id;
-- 
2.10.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2 5/5] staging:android:ion: Fix void function return

2016-09-23 Thread giannis . damigos
From: Yannis Damigos 

This patch removes the return statement of void function

WARNING: void function return statements are not generally useful
+   return;
+}

Signed-off-by: Yannis Damigos 
---
 drivers/staging/android/ion/ion_of.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index 49f052c..c930416 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -161,7 +161,6 @@ static int rmem_ion_device_init(struct reserved_mem *rmem, 
struct device *dev)
 static void rmem_ion_device_release(struct reserved_mem *rmem,
struct device *dev)
 {
-   return;
 }
 
 static const struct reserved_mem_ops rmem_dma_ops = {
-- 
2.10.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2 2/5] staging:android:ion: Fix whitespace issues

2016-09-23 Thread giannis . damigos
From: Yannis Damigos 

This patch fixes the following whitespace issues:

CHECK: Alignment should match open parenthesis
+int ion_parse_dt_heap_common(struct device_node *heap_node,
+   struct ion_platform_heap *heap,

CHECK: Alignment should match open parenthesis
+   pr_info("%s: id %d type %d name %s align %lx\n", __func__,
+   heap->id, heap->type, heap->name, heap->align);

CHECK: Alignment should match open parenthesis
+int ion_setup_heap_common(struct platform_device *parent,
+   struct device_node *heap_node,

CHECK: Alignment should match open parenthesis
+struct ion_platform_data *ion_parse_dt(struct platform_device *pdev,
+   struct ion_of_heap *compatible)

CHECK: Alignment should match open parenthesis
+   heaps = devm_kzalloc(&pdev->dev,
+   sizeof(struct
ion_platform_heap)*num_heaps,

CHECK: spaces preferred around that '*' (ctx:VxV)
+   sizeof(struct
ion_platform_heap)*num_heaps,

CHECK: Alignment should match open parenthesis
+   data = devm_kzalloc(&pdev->dev, sizeof(struct
ion_platform_data),
+   GFP_KERNEL);

CHECK: Alignment should match open parenthesis
+   heap_pdev = of_platform_device_create(node,
heaps[i].name,
+   &pdev->dev);

CHECK: Alignment should match open parenthesis
+   pr_debug("%s: heap %s base %pa size %pa dev %p\n", __func__,
+   heap->name, &rmem->base, &rmem->size, dev);

CHECK: Alignment should match open parenthesis
+static void rmem_ion_device_release(struct reserved_mem *rmem,
+   struct device *dev)

Signed-off-by: Yannis Damigos 
---
 drivers/staging/android/ion/ion_of.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index b3da8d8..b7babc7 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -26,8 +26,8 @@
 #include "ion_of.h"
 
 int ion_parse_dt_heap_common(struct device_node *heap_node,
-   struct ion_platform_heap *heap,
-   struct ion_of_heap *compatible)
+struct ion_platform_heap *heap,
+struct ion_of_heap *compatible)
 {
int i;
 
@@ -47,13 +47,13 @@ int ion_parse_dt_heap_common(struct device_node *heap_node,
/* Some kind of callback function pointer? */
 
pr_info("%s: id %d type %d name %s align %lx\n", __func__,
-   heap->id, heap->type, heap->name, heap->align);
+   heap->id, heap->type, heap->name, heap->align);
return 0;
 }
 
 int ion_setup_heap_common(struct platform_device *parent,
-   struct device_node *heap_node,
-   struct ion_platform_heap *heap)
+ struct device_node *heap_node,
+ struct ion_platform_heap *heap)
 {
int ret = 0;
 
@@ -73,7 +73,7 @@ int ion_setup_heap_common(struct platform_device *parent,
 }
 
 struct ion_platform_data *ion_parse_dt(struct platform_device *pdev,
-   struct ion_of_heap *compatible)
+  struct ion_of_heap *compatible)
 {
int num_heaps, ret;
const struct device_node *dt_node = pdev->dev.of_node;
@@ -88,13 +88,13 @@ struct ion_platform_data *ion_parse_dt(struct 
platform_device *pdev,
return ERR_PTR(-EINVAL);
 
heaps = devm_kzalloc(&pdev->dev,
-   sizeof(struct ion_platform_heap)*num_heaps,
-   GFP_KERNEL);
+sizeof(struct ion_platform_heap) * num_heaps,
+GFP_KERNEL);
if (!heaps)
return ERR_PTR(-ENOMEM);
 
data = devm_kzalloc(&pdev->dev, sizeof(struct ion_platform_data),
-   GFP_KERNEL);
+   GFP_KERNEL);
if (!data)
return ERR_PTR(-ENOMEM);
 
@@ -106,7 +106,7 @@ struct ion_platform_data *ion_parse_dt(struct 
platform_device *pdev,
return ERR_PTR(ret);
 
heap_pdev = of_platform_device_create(node, heaps[i].name,
-   &pdev->dev);
+ &pdev->dev);
if (!pdev)
return ERR_PTR(-ENOMEM);
heap_pdev->dev.platform_data = &heaps[i];
@@ -155,12 +155,12 @@ static int rmem_ion_device_init(struct reserved_mem 
*rmem, struct device *dev)
heap->base = rmem->base;
heap->base = rmem->size;
pr_debug("%s: heap %s base %pa size %pa dev %p\n", __func__,
-  

[PATCHv2 3/5] staging:android:ion: Fix blank line issues

2016-09-23 Thread giannis . damigos
From: Yannis Damigos 

This patch fixes the following blank line issues:

CHECK: Please don't use multiple blank lines
+
+

CHECK: Please use a blank line after function/struct/union/enum
declarations
+}
+RESERVEDMEM_OF_DECLARE(ion, "ion-region", rmem_ion_setup);

Signed-off-by: Yannis Damigos 
---
 drivers/staging/android/ion/ion_of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index b7babc7..23f51a3 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -119,7 +119,6 @@ struct ion_platform_data *ion_parse_dt(struct 
platform_device *pdev,
i++;
}
 
-
data->heaps = heaps;
data->nr = num_heaps;
return data;
@@ -181,5 +180,6 @@ static int __init rmem_ion_setup(struct reserved_mem *rmem)
rmem->ops = &rmem_dma_ops;
return 0;
 }
+
 RESERVEDMEM_OF_DECLARE(ion, "ion-region", rmem_ion_setup);
 #endif
-- 
2.10.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv2 4/5] staging:android:ion: Fix switch case indentation

2016-09-23 Thread giannis . damigos
From: Yannis Damigos 

This patch fixes the following switch statement indentation issue:

ERROR: switch and case should be at the same indent
+   switch (heap->type) {
+   case ION_HEAP_TYPE_CARVEOUT:
+   case ION_HEAP_TYPE_CHUNK:
[...]
+   default:

Signed-off-by: Yannis Damigos 
---
 drivers/staging/android/ion/ion_of.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index 23f51a3..49f052c 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -58,15 +58,15 @@ int ion_setup_heap_common(struct platform_device *parent,
int ret = 0;
 
switch (heap->type) {
-   case ION_HEAP_TYPE_CARVEOUT:
-   case ION_HEAP_TYPE_CHUNK:
-   if (heap->base && heap->size)
-   return 0;
-
-   ret = of_reserved_mem_device_init(heap->priv);
-   break;
-   default:
-   break;
+   case ION_HEAP_TYPE_CARVEOUT:
+   case ION_HEAP_TYPE_CHUNK:
+   if (heap->base && heap->size)
+   return 0;
+
+   ret = of_reserved_mem_device_init(heap->priv);
+   break;
+   default:
+   break;
}
 
return ret;
-- 
2.10.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel