All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: ion: ion_cma_heap: remove ion_cma_get_sgtable
@ 2014-12-09  1:19 Zeng Tao
  2014-12-09  1:29 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng Tao @ 2014-12-09  1:19 UTC (permalink / raw)
  To: gregkh, john.stultz, ccross, rebecca, fabio.estevam, tranmanphong,
	benjamin.gaignard
  Cc: devel, linux-kernel

Remove the temporary code ion_cma_get_sgtable,
use dma_common_get_sgtable instead

Signed-off-by: Zeng Tao <prime.zeng@huawei.com>
---
 drivers/staging/android/ion/ion_cma_heap.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index f8cabcb..f4211f1 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -39,24 +39,6 @@ struct ion_cma_buffer_info {
 	struct sg_table *table;
 };
 
-/*
- * Create scatter-list for the already allocated DMA buffer.
- * This function could be replaced by dma_common_get_sgtable
- * as soon as it will avalaible.
- */
-static int ion_cma_get_sgtable(struct device *dev, struct sg_table *sgt,
-			       void *cpu_addr, dma_addr_t handle, size_t size)
-{
-	struct page *page = virt_to_page(cpu_addr);
-	int ret;
-
-	ret = sg_alloc_table(sgt, 1, GFP_KERNEL);
-	if (unlikely(ret))
-		return ret;
-
-	sg_set_page(sgt->sgl, page, PAGE_ALIGN(size), 0);
-	return 0;
-}
 
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
@@ -91,7 +73,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	if (!info->table)
 		goto free_mem;
 
-	if (ion_cma_get_sgtable
+	if (dma_common_get_sgtable
 	    (dev, info->table, info->cpu_addr, info->handle, len))
 		goto free_table;
 	/* keep this for memory release */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: ion: ion_cma_heap: remove ion_cma_get_sgtable
  2014-12-09  1:19 [PATCH] staging: ion: ion_cma_heap: remove ion_cma_get_sgtable Zeng Tao
@ 2014-12-09  1:29 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2014-12-09  1:29 UTC (permalink / raw)
  To: Zeng Tao
  Cc: gregkh, john.stultz, ccross, rebecca, fabio.estevam, tranmanphong,
	benjamin.gaignard, devel, linux-kernel

On Tue, 2014-12-09 at 09:19 +0800, Zeng Tao wrote:
> Remove the temporary code ion_cma_get_sgtable,
> use dma_common_get_sgtable instead
[]
> diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
[]
> @@ -91,7 +73,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
>  	if (!info->table)
>  		goto free_mem;
>  
> -	if (ion_cma_get_sgtable
> +	if (dma_common_get_sgtable
>  	    (dev, info->table, info->cpu_addr, info->handle, len))
>  		goto free_table;
>  	/* keep this for memory release */

somewhat unrelated trivia:

It'd conform a bit more to kernel style to
write this with at least one argument on the
same line as the function like:

	if (dma_common_get_sgtable(dev, info->table, info->cpu_addr,
				   info->handle, len))
		goto  free_table;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-09  1:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-09  1:19 [PATCH] staging: ion: ion_cma_heap: remove ion_cma_get_sgtable Zeng Tao
2014-12-09  1:29 ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.