From fbd890a169ef04ce520ca93ec5a751cc7c675aad Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 1 Jun 2023 10:57:57 +0900 Subject: [PATCH] staging: android: ion: Fix build error without CONFIG_AMLOGIC_ION_CODEC_MM The amlogic codec ion is not used, threre is build error. Fix the build error with checking config option. Change-Id: Id21dcb4285facd5ed8c22082d8923be2c460909b Fixes: deca8a9c7029 ("ion_dev: add codec_mm heap for omx. [3/3]") Signed-off-by: Seung-Woo Kim --- drivers/staging/android/ion/Makefile | 5 ++++- drivers/staging/android/ion/ion_heap.c | 4 ++++ drivers/staging/android/ion/ion_priv.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/Makefile b/drivers/staging/android/ion/Makefile index 9fc31203cf19..12b01248edfb 100644 --- a/drivers/staging/android/ion/Makefile +++ b/drivers/staging/android/ion/Makefile @@ -1,10 +1,13 @@ obj-$(CONFIG_ION) += ion.o ion-ioctl.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_codec_mm_heap.o + ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o obj-$(CONFIG_ION_TEST) += ion_test.o ifdef CONFIG_COMPAT obj-$(CONFIG_ION) += compat_ion.o endif +ifdef CONFIG_AMLOGIC_MEDIA_CODEC_MM +obj-$(CONFIG_ION) += ion_codec_mm_heap.o +endif obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o obj-$(CONFIG_ION_TEGRA) += tegra/ diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index 730035786015..da2e75573a97 100644 --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c @@ -335,9 +335,11 @@ struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data) case ION_HEAP_TYPE_DMA: heap = ion_cma_heap_create(heap_data); break; +#if defined(CONFIG_AMLOGIC_MEDIA_CODEC_MM) case ION_HEAP_TYPE_CUSTOM: heap = ion_codec_mm_heap_create(heap_data); break; +#endif default: pr_err("%s: Invalid heap type %d\n", __func__, heap_data->type); @@ -378,9 +380,11 @@ void ion_heap_destroy(struct ion_heap *heap) case ION_HEAP_TYPE_DMA: ion_cma_heap_destroy(heap); break; +#if defined(CONFIG_AMLOGIC_MEDIA_CODEC_MM) case ION_HEAP_TYPE_CUSTOM: ion_codec_mm_heap_destroy(heap); break; +#endif default: pr_err("%s: Invalid heap type %d\n", __func__, heap->type); diff --git a/drivers/staging/android/ion/ion_priv.h b/drivers/staging/android/ion/ion_priv.h index b1371975c8d2..d557cf5e66c1 100644 --- a/drivers/staging/android/ion/ion_priv.h +++ b/drivers/staging/android/ion/ion_priv.h @@ -388,6 +388,7 @@ void ion_chunk_heap_destroy(struct ion_heap *); struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *); void ion_cma_heap_destroy(struct ion_heap *); +#if defined(CONFIG_AMLOGIC_MEDIA_CODEC_MM) /** * The codec_mm heap returns physical addresses, since 0 may be a valid * physical address, this is used to indicate allocation failed @@ -400,6 +401,7 @@ void ion_cma_heap_destroy(struct ion_heap *); */ struct ion_heap *ion_codec_mm_heap_create(struct ion_platform_heap *heap_data); void ion_codec_mm_heap_destroy(struct ion_heap *heap); +#endif /** * functions for creating and destroying a heap pool -- allows you -- 2.34.1