[PATCH v3 5/5] Staging: android: use BIT macro

2017-07-09 Thread Mateusz Nowotyński
Use BIT macro instead of left shifting in android/ion/ion.h

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index b91328a..621e5f7 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -135,7 +135,7 @@ struct ion_heap_ops {
 /**
  * heap flags - flags between the heaps and core ion code
  */
-#define ION_HEAP_FLAG_DEFER_FREE (1 << 0)
+#define ION_HEAP_FLAG_DEFER_FREE BIT(0)
 
 /**
  * private flags - flags internal to ion
@@ -146,7 +146,7 @@ struct ion_heap_ops {
  * any buffer storage that came from the system allocator will be
  * returned to the system allocator.
  */
-#define ION_PRIV_FLAG_SHRINKER_FREE (1 << 0)
+#define ION_PRIV_FLAG_SHRINKER_FREE BIT(0)
 
 /**
  * struct ion_heap - represents a heap in the system
-- 
2.10.2

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


[PATCH v3 3/5] Staging: android: Remove unnecessary blank lines

2017-07-09 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion_system_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_system_heap.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 5964bf2..4dc5d7a 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -98,7 +98,6 @@ static void free_buffer_page(struct ion_system_heap *heap,
ion_page_pool_free(pool, page);
 }
 
-
 static struct page *alloc_largest_available(struct ion_system_heap *heap,
struct ion_buffer *buffer,
unsigned long size,
@@ -256,7 +255,6 @@ static struct ion_heap_ops system_heap_ops = {
 static int ion_system_heap_debug_show(struct ion_heap *heap, struct seq_file 
*s,
  void *unused)
 {
-
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
-- 
2.10.2

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


[PATCH v3 2/5] Staging: android: fix sizeof style issue

2017-07-09 Thread Mateusz Nowotyński
Converts sizeof(type) to sizeof(variable) in android/ion/ion_cma_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index b06f4ce..bb2c144 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -45,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
if (!pages)
return -ENOMEM;
 
-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table)
goto err;
 
-- 
2.10.2

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


[PATCH v3 1/5] Staging: android: remove unnecessary blank lines

2017-07-09 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion_cma_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_cma_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..b06f4ce 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -31,7 +31,6 @@ struct ion_cma_heap {
 
 #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)
 
-
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
unsigned long len,
-- 
2.10.2

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


[PATCH v3 4/5] Staging: android: Fix code alignment issue

2017-07-09 Thread Mateusz Nowotyński
Fixes code alignment issue in ion/ion.h

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index fa9ed81..b91328a 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -226,8 +226,8 @@ int ion_heap_buffer_zero(struct ion_buffer *buffer);
 int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot);
 
 int ion_alloc(size_t len,
-   unsigned int heap_id_mask,
-   unsigned int flags);
+ unsigned int heap_id_mask,
+ unsigned int flags);
 
 /**
  * ion_heap_init_shrinker
@@ -291,7 +291,7 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, 
size_t size);
  * flag.
  */
 size_t ion_heap_freelist_shrink(struct ion_heap *heap,
-   size_t size);
+   size_t size);
 
 /**
  * ion_heap_freelist_size - returns the size of the freelist in bytes
@@ -352,7 +352,7 @@ void ion_page_pool_free(struct ion_page_pool *pool, struct 
page *page);
  * returns the number of items freed in pages
  */
 int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
- int nr_to_scan);
+int nr_to_scan);
 
 long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
 
-- 
2.10.2

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


[PATCH v2 06/11] Staging: android: remove unnecessary blank lines

2017-05-29 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion_cma_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_cma_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..b06f4ce 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -31,7 +31,6 @@ struct ion_cma_heap {
 
 #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)
 
-
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
unsigned long len,
-- 
2.10.2

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


[PATCH v2 09/11] Staging: android: fix sizeof style issue

2017-05-29 Thread Mateusz Nowotyński
Converts sizeof(type) to sizeof(variable) in android/ion/ion_system_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_system_heap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 2c5bfbf..4dc5d7a 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -152,7 +152,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
max_order = compound_order(page);
i++;
}
-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table)
goto free_pages;
 
@@ -381,7 +381,7 @@ static int ion_system_contig_heap_allocate(struct ion_heap 
*heap,
for (i = len >> PAGE_SHIFT; i < (1 << order); i++)
__free_page(page + i);
 
-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table) {
ret = -ENOMEM;
goto free_pages;
@@ -431,7 +431,7 @@ static struct ion_heap 
*__ion_system_contig_heap_create(void)
 {
struct ion_heap *heap;
 
-   heap = kzalloc(sizeof(struct ion_heap), GFP_KERNEL);
+   heap = kzalloc(sizeof(*heap), GFP_KERNEL);
if (!heap)
return ERR_PTR(-ENOMEM);
heap->ops = &kmalloc_ops;
-- 
2.10.2

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


[PATCH v2 11/11] Staging: android: use BIT macro

2017-05-29 Thread Mateusz Nowotyński
Use BIT macro instead of left shifting in android/ion/ion.h

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index 4f04f65..6cc720b 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -149,7 +149,7 @@ struct ion_heap_ops {
 /**
  * heap flags - flags between the heaps and core ion code
  */
-#define ION_HEAP_FLAG_DEFER_FREE (1 << 0)
+#define ION_HEAP_FLAG_DEFER_FREE BIT(0)
 
 /**
  * private flags - flags internal to ion
@@ -160,7 +160,7 @@ struct ion_heap_ops {
  * any buffer storage that came from the system allocator will be
  * returned to the system allocator.
  */
-#define ION_PRIV_FLAG_SHRINKER_FREE (1 << 0)
+#define ION_PRIV_FLAG_SHRINKER_FREE BIT(0)
 
 /**
  * struct ion_heap - represents a heap in the system
-- 
2.10.2

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


[PATCH v2 08/11] Staging: android: Remove unnecessary blank lines

2017-05-29 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion_system_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_system_heap.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index c50f2d9..2c5bfbf 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -98,7 +98,6 @@ static void free_buffer_page(struct ion_system_heap *heap,
ion_page_pool_free(pool, page);
 }
 
-
 static struct page *alloc_largest_available(struct ion_system_heap *heap,
struct ion_buffer *buffer,
unsigned long size,
@@ -256,7 +255,6 @@ static struct ion_heap_ops system_heap_ops = {
 static int ion_system_heap_debug_show(struct ion_heap *heap, struct seq_file 
*s,
  void *unused)
 {
-
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
-- 
2.10.2

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


[PATCH v2 07/11] Staging: android: fix sizeof style issue

2017-05-29 Thread Mateusz Nowotyński
Converts sizeof(type) to sizeof(variable) in android/ion/ion_cma_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index b06f4ce..bb2c144 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -45,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
if (!pages)
return -ENOMEM;
 
-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table)
goto err;
 
-- 
2.10.2

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


[PATCH v2 10/11] Staging: android: Fix code alignment issue

2017-05-29 Thread Mateusz Nowotyński
Fixes code alignment issue in ion/ion.h

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index ace8416..4f04f65 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -240,8 +240,8 @@ int ion_heap_buffer_zero(struct ion_buffer *buffer);
 int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot);
 
 int ion_alloc(size_t len,
-   unsigned int heap_id_mask,
-   unsigned int flags);
+ unsigned int heap_id_mask,
+ unsigned int flags);
 
 /**
  * ion_heap_init_shrinker
@@ -305,7 +305,7 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, 
size_t size);
  * flag.
  */
 size_t ion_heap_freelist_shrink(struct ion_heap *heap,
-   size_t size);
+   size_t size);
 
 /**
  * ion_heap_freelist_size - returns the size of the freelist in bytes
@@ -366,7 +366,7 @@ void ion_page_pool_free(struct ion_page_pool *pool, struct 
page *page);
  * returns the number of items freed in pages
  */
 int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
- int nr_to_scan);
+int nr_to_scan);
 
 long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
 
-- 
2.10.2

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


[PATCH v2 05/11] Staging: android: Fix code alignment issue

2017-05-29 Thread Mateusz Nowotyński
Fixes code alignment issue in ion/ion_carveout_heap.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_carveout_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index 5fdc1f3..fee7650 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -33,7 +33,7 @@ struct ion_carveout_heap {
 };
 
 static phys_addr_t ion_carveout_allocate(struct ion_heap *heap,
-unsigned long size)
+unsigned long size)
 {
struct ion_carveout_heap *carveout_heap =
container_of(heap, struct ion_carveout_heap, heap);
-- 
2.10.2

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


[PATCH v2 01/11] Staging: android: Fix style issue in ion-ioctl.c

2017-05-29 Thread Mateusz Nowotyński
This is patch fixing code alignment style issue in
android/ion/ion-ioctl.c file

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion-ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 76427e4..d9f8b14 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -83,8 +83,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
int fd;
 
fd = ion_alloc(data.allocation.len,
-   data.allocation.heap_id_mask,
-   data.allocation.flags);
+  data.allocation.heap_id_mask,
+  data.allocation.flags);
if (fd < 0)
return fd;
 
-- 
2.10.2

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


[PATCH v2 02/11] Staging: android: NULL comparasion in ion.c file

2017-05-29 Thread Mateusz Nowotyński
Fixes NULL comparison coding style issues in
android/ion/ion.c file

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 03d3a4f..73f90e6 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -103,7 +103,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap 
*heap,
goto err2;
}
 
-   if (buffer->sg_table == NULL) {
+   if (!buffer->sg_table) {
WARN_ONCE(1, "This heap needs to set the sgtable");
ret = -EINVAL;
goto err1;
@@ -163,7 +163,7 @@ static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
return buffer->vaddr;
}
vaddr = buffer->heap->ops->map_kernel(buffer->heap, buffer);
-   if (WARN_ONCE(vaddr == NULL,
+   if (WARN_ONCE(!vaddr,
  "heap->ops->map_kernel should return ERR_PTR on error"))
return ERR_PTR(-EINVAL);
if (IS_ERR(vaddr))
@@ -435,7 +435,7 @@ int ion_alloc(size_t len, unsigned int heap_id_mask, 
unsigned int flags)
}
up_read(&dev->lock);
 
-   if (buffer == NULL)
+   if (!buffer)
return -ENODEV;
 
if (IS_ERR(buffer))
-- 
2.10.2

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


[PATCH v2 03/11] Staging: android: Fix alignment issue in ion.c

2017-05-29 Thread Mateusz Nowotyński
Fixes code alignment style issues in android/ion/ion.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 73f90e6..e10c696 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -221,7 +221,7 @@ struct ion_dma_buf_attachment {
 };
 
 static int ion_dma_buf_attach(struct dma_buf *dmabuf, struct device *dev,
-   struct dma_buf_attachment *attachment)
+ struct dma_buf_attachment *attachment)
 {
struct ion_dma_buf_attachment *a;
struct sg_table *table;
@@ -358,7 +358,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
-   DMA_BIDIRECTIONAL);
+   DMA_BIDIRECTIONAL);
}
mutex_unlock(&buffer->lock);
 
@@ -380,7 +380,7 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf 
*dmabuf,
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
dma_sync_sg_for_device(a->dev, a->table->sgl, a->table->nents,
-   DMA_BIDIRECTIONAL);
+  DMA_BIDIRECTIONAL);
}
mutex_unlock(&buffer->lock);
 
-- 
2.10.2

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


[PATCH v2 04/11] Staging: android: remove unnecessary blank lines

2017-05-29 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion.c

Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index e10c696..11acbe2 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -264,7 +264,6 @@ static void ion_dma_buf_detatch(struct dma_buf *dmabuf,
kfree(a);
 }
 
-
 static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment,
enum dma_data_direction direction)
 {
@@ -354,7 +353,6 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
mutex_unlock(&buffer->lock);
}
 
-
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
-- 
2.10.2

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


[PATCH 10/11] Staging: android: Fix code alignment issue

2017-05-28 Thread Mateusz Nowotyński
Fixes code alignment issue in ion/ion.h
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index ace8416..4f04f65 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -240,8 +240,8 @@ int ion_heap_buffer_zero(struct ion_buffer *buffer);
 int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot);
 
 int ion_alloc(size_t len,
-   unsigned int heap_id_mask,
-   unsigned int flags);
+ unsigned int heap_id_mask,
+ unsigned int flags);
 
 /**
  * ion_heap_init_shrinker
@@ -305,7 +305,7 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, 
size_t size);
  * flag.
  */
 size_t ion_heap_freelist_shrink(struct ion_heap *heap,
-   size_t size);
+   size_t size);
 
 /**
  * ion_heap_freelist_size - returns the size of the freelist in bytes
@@ -366,7 +366,7 @@ void ion_page_pool_free(struct ion_page_pool *pool, struct 
page *page);
  * returns the number of items freed in pages
  */
 int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
- int nr_to_scan);
+int nr_to_scan);
 
 long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
 
-- 
2.10.2

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


[PATCH 11/11] Staging: android: use BIT macro

2017-05-28 Thread Mateusz Nowotyński
Use BIT macro instead of left shifting in android/ion/ion.h
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index 4f04f65..6cc720b 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -149,7 +149,7 @@ struct ion_heap_ops {
 /**
  * heap flags - flags between the heaps and core ion code
  */
-#define ION_HEAP_FLAG_DEFER_FREE (1 << 0)
+#define ION_HEAP_FLAG_DEFER_FREE BIT(0)
 
 /**
  * private flags - flags internal to ion
@@ -160,7 +160,7 @@ struct ion_heap_ops {
  * any buffer storage that came from the system allocator will be
  * returned to the system allocator.
  */
-#define ION_PRIV_FLAG_SHRINKER_FREE (1 << 0)
+#define ION_PRIV_FLAG_SHRINKER_FREE BIT(0)
 
 /**
  * struct ion_heap - represents a heap in the system
-- 
2.10.2

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


[PATCH 05/11] Staging: android: Fix code alignment issue

2017-05-28 Thread Mateusz Nowotyński
Fixes code alignment issue in ion/ion_carveout_heap.c
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_carveout_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index 5fdc1f3..fee7650 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -33,7 +33,7 @@ struct ion_carveout_heap {
 };
 
 static phys_addr_t ion_carveout_allocate(struct ion_heap *heap,
-unsigned long size)
+unsigned long size)
 {
struct ion_carveout_heap *carveout_heap =
container_of(heap, struct ion_carveout_heap, heap);
-- 
2.10.2

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


[PATCH 04/11] Staging: android: remove unnecessary blank lines

2017-05-28 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion.c
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index e10c696..11acbe2 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -264,7 +264,6 @@ static void ion_dma_buf_detatch(struct dma_buf *dmabuf,
kfree(a);
 }
 
-
 static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment,
enum dma_data_direction direction)
 {
@@ -354,7 +353,6 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
mutex_unlock(&buffer->lock);
}
 
-
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
-- 
2.10.2

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


[PATCH 03/11] Staging: android: Fix alignment issue in ion.c

2017-05-28 Thread Mateusz Nowotyński
Fixes code alignment style issues in android/ion/ion.c
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 73f90e6..e10c696 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -221,7 +221,7 @@ struct ion_dma_buf_attachment {
 };
 
 static int ion_dma_buf_attach(struct dma_buf *dmabuf, struct device *dev,
-   struct dma_buf_attachment *attachment)
+ struct dma_buf_attachment *attachment)
 {
struct ion_dma_buf_attachment *a;
struct sg_table *table;
@@ -358,7 +358,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
-   DMA_BIDIRECTIONAL);
+   DMA_BIDIRECTIONAL);
}
mutex_unlock(&buffer->lock);
 
@@ -380,7 +380,7 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf 
*dmabuf,
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
dma_sync_sg_for_device(a->dev, a->table->sgl, a->table->nents,
-   DMA_BIDIRECTIONAL);
+  DMA_BIDIRECTIONAL);
}
mutex_unlock(&buffer->lock);
 
-- 
2.10.2

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


[PATCH 08/11] Staging: android: Remove unnecessary blank lines

2017-05-28 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion_system_heap.c
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_system_heap.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index c50f2d9..2c5bfbf 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -98,7 +98,6 @@ static void free_buffer_page(struct ion_system_heap *heap,
ion_page_pool_free(pool, page);
 }
 
-
 static struct page *alloc_largest_available(struct ion_system_heap *heap,
struct ion_buffer *buffer,
unsigned long size,
@@ -256,7 +255,6 @@ static struct ion_heap_ops system_heap_ops = {
 static int ion_system_heap_debug_show(struct ion_heap *heap, struct seq_file 
*s,
  void *unused)
 {
-
struct ion_system_heap *sys_heap = container_of(heap,
struct ion_system_heap,
heap);
-- 
2.10.2

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


[PATCH 02/11] Staging: android: NULL comparasion in ion.c file

2017-05-28 Thread Mateusz Nowotyński
Fixes NULL comparison coding style issues in
android/ion/ion.c file
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 03d3a4f..73f90e6 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -103,7 +103,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap 
*heap,
goto err2;
}
 
-   if (buffer->sg_table == NULL) {
+   if (!buffer->sg_table) {
WARN_ONCE(1, "This heap needs to set the sgtable");
ret = -EINVAL;
goto err1;
@@ -163,7 +163,7 @@ static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
return buffer->vaddr;
}
vaddr = buffer->heap->ops->map_kernel(buffer->heap, buffer);
-   if (WARN_ONCE(vaddr == NULL,
+   if (WARN_ONCE(!vaddr,
  "heap->ops->map_kernel should return ERR_PTR on error"))
return ERR_PTR(-EINVAL);
if (IS_ERR(vaddr))
@@ -435,7 +435,7 @@ int ion_alloc(size_t len, unsigned int heap_id_mask, 
unsigned int flags)
}
up_read(&dev->lock);
 
-   if (buffer == NULL)
+   if (!buffer)
return -ENODEV;
 
if (IS_ERR(buffer))
-- 
2.10.2

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


[PATCH 01/11] Staging: android: Fix style issue in ion-ioctl.c

2017-05-28 Thread Mateusz Nowotyński
This is patch fixing code alignment style issue in
android/ion/ion-ioctl.c file
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion-ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 76427e4..d9f8b14 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -83,8 +83,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
int fd;
 
fd = ion_alloc(data.allocation.len,
-   data.allocation.heap_id_mask,
-   data.allocation.flags);
+  data.allocation.heap_id_mask,
+  data.allocation.flags);
if (fd < 0)
return fd;
 
-- 
2.10.2

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


[PATCH 09/11] Staging: android: fix sizeof style issue

2017-05-28 Thread Mateusz Nowotyński
Converts sizeof(type) to sizeof(variable) in android/ion/ion_system_heap.c
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_system_heap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 2c5bfbf..4dc5d7a 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -152,7 +152,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
max_order = compound_order(page);
i++;
}
-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table)
goto free_pages;
 
@@ -381,7 +381,7 @@ static int ion_system_contig_heap_allocate(struct ion_heap 
*heap,
for (i = len >> PAGE_SHIFT; i < (1 << order); i++)
__free_page(page + i);
 
-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table) {
ret = -ENOMEM;
goto free_pages;
@@ -431,7 +431,7 @@ static struct ion_heap 
*__ion_system_contig_heap_create(void)
 {
struct ion_heap *heap;
 
-   heap = kzalloc(sizeof(struct ion_heap), GFP_KERNEL);
+   heap = kzalloc(sizeof(*heap), GFP_KERNEL);
if (!heap)
return ERR_PTR(-ENOMEM);
heap->ops = &kmalloc_ops;
-- 
2.10.2

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


[PATCH 07/11] Staging: android: fix sizeof style issue

2017-05-28 Thread Mateusz Nowotyński
Converts sizeof(type) to sizeof(variable) in android/ion/ion_cma_heap.c
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_cma_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index b06f4ce..bb2c144 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -45,7 +45,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
if (!pages)
return -ENOMEM;
 
-   table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
+   table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table)
goto err;
 
-- 
2.10.2

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


[PATCH 06/11] Staging: android: remove unnecessary blank lines

2017-05-28 Thread Mateusz Nowotyński
Removes unnecessary blank lines in android/ion/ion_cma_heap.c
Signed-off-by: Mateusz Nowotyński 
---
 drivers/staging/android/ion/ion_cma_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a0949bc..b06f4ce 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -31,7 +31,6 @@ struct ion_cma_heap {
 
 #define to_cma_heap(x) container_of(x, struct ion_cma_heap, heap)
 
-
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
unsigned long len,
-- 
2.10.2

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