ion: only use the CMA heap when CONFIG_CMA is enabled
Subsystems (2)
PATCH 1/1 ion: only use the CMA heap when CONFIG_CMA is enabled
The CMA heap is intended to be used with CMA (as the name suggests). Don't compile or use it if CONFIG_CMA is not enabled.
Currently, if CONFIG_CMA=n and someone creates and uses a CMA heap, some of their allocations might actually succeed (since the CMA heap is just using generic DMA API routines) but the fact that the memory isn't coming from CMA is confusing.
Signed-off-by Mitchel Humpherys <[email protected]>
--- drivers/staging/android/ion/Makefile | 3 ++- drivers/staging/android/ion/ion_heap.c | 4 ++++ drivers/staging/android/ion/ion_priv.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/staging/android/ion/Makefile +2 -1
@@ -1,5 +1,6 @@ obj-$(CONFIG_ION) += ion.o ion_heap.o ion_page_pool.o ion_system_heap.o \ - ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o + ion_carveout_heap.o ion_chunk_heap.o +obj-$(CONFIG_CMA) += ion_cma_heap.o obj-$(CONFIG_ION_TEST) += ion_test.o ifdef CONFIG_COMPAT obj-$(CONFIG_ION) += compat_ion.o
drivers/staging/android/ion/ion_heap.c +4 -0
@@ -332,9 +332,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_CMA 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);
@@ -371,9 +373,11 @@ void ion_heap_destroy(struct ion_heap *heap)case ION_HEAP_TYPE_CHUNK :ion_chunk_heap_destroy (heap);break ; +#ifdef CONFIG_CMA case ION_HEAP_TYPE_DMA :ion_cma_heap_destroy (heap);break ; +#endif default :pr_err ("%s: Invalid heap type %d\n" , __func__, heap->type);
drivers/staging/android/ion/ion_priv.h +3 -0
@@ -323,8 +323,11 @@ void ion_carveout_heap_destroy(struct ion_heap *);struct ion_heap *ion_chunk_heap_create (struct ion_platform_heap *);void ion_chunk_heap_destroy (struct ion_heap *); + +#ifdef CONFIG_CMA struct ion_heap *ion_cma_heap_create (struct ion_platform_heap *);void ion_cma_heap_destroy (struct ion_heap *); +#endif /** * kernel api to allocate/free from carveout -- used when carveout is
Signature · 8 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>