summaryrefslogtreecommitdiffstats
path: root/drivers/staging/android/ion/ion_heap.c
diff options
context:
space:
mode:
authorLaura Abbott <labbott@redhat.com>2017-04-18 11:27:05 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-18 20:41:12 +0200
commit204f672255c228ef7a66c29ae48123778da938a1 (patch)
tree038f782b7abb1290f34fad60659e9dede9d681ad /drivers/staging/android/ion/ion_heap.c
parente4231bcda72daef497af45e195a33daa0f9357d0 (diff)
staging: android: ion: Use CMA APIs directly
When CMA was first introduced, its primary use was for DMA allocation and the only way to get CMA memory was to call dma_alloc_coherent. This put Ion in an awkward position since there was no device structure readily available and setting one up messed up the coherency model. These days, CMA can be allocated directly from the APIs. Switch to using this model to avoid needing a dummy device. This also mitigates some of the caching problems (e.g. dma_alloc_coherent only returning uncached memory). Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android/ion/ion_heap.c')
-rw-r--r--drivers/staging/android/ion/ion_heap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c
index c69d0bd53693..66f8fc5c8cee 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -333,9 +333,11 @@ struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data)
case ION_HEAP_TYPE_CHUNK:
heap = ion_chunk_heap_create(heap_data);
break;
+#ifdef CONFIG_ION_CMA_HEAP
case ION_HEAP_TYPE_DMA:
heap = ion_cma_heap_create(heap_data);
break;
+#endif
default:
pr_err("%s: Invalid heap type %d\n", __func__,
heap_data->type);
@@ -373,9 +375,11 @@ void ion_heap_destroy(struct ion_heap *heap)
case ION_HEAP_TYPE_CHUNK:
ion_chunk_heap_destroy(heap);
break;
+#ifdef CONFIG_ION_CMA_HEAP
case ION_HEAP_TYPE_DMA:
ion_cma_heap_destroy(heap);
break;
+#endif
default:
pr_err("%s: Invalid heap type %d\n", __func__,
heap->type);