Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f64a8b79 authored by Hridya Valsaraju's avatar Hridya Valsaraju
Browse files

ANDROID: staging: android: ion: enable modularizing the ion driver



This patch enable setting CONFIG_ION=m.

Bug: 147914088
Test: Build, boot, video playback is successful.
Change-Id: I014046fec793a10a61669faa18aa655048d5aaa4
Signed-off-by: default avatarHridya Valsaraju <hridya@google.com>
parent 025a1ee6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
menuconfig ION
	bool "Ion Memory Manager"
	tristate "Ion Memory Manager"
	depends on HAVE_MEMBLOCK && HAS_DMA && MMU
	select GENERIC_ALLOCATOR
	select DMA_SHARED_BUFFER
+6 −5
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_ION) +=	ion.o ion-ioctl.o ion_heap.o
obj-$(CONFIG_ION_SYSTEM_HEAP) += ion_system_heap.o ion_page_pool.o
obj-$(CONFIG_ION_CARVEOUT_HEAP) += ion_carveout_heap.o
obj-$(CONFIG_ION_CHUNK_HEAP) += ion_chunk_heap.o
obj-$(CONFIG_ION_CMA_HEAP) += ion_cma_heap.o
obj-$(CONFIG_ION) +=	ion-alloc.o
ion-alloc-objs += ion.o ion-ioctl.o ion_heap.o
ion-alloc-$(CONFIG_ION_SYSTEM_HEAP) += ion_system_heap.o ion_page_pool.o
ion-alloc-$(CONFIG_ION_CARVEOUT_HEAP) += ion_carveout_heap.o
ion-alloc-$(CONFIG_ION_CHUNK_HEAP) += ion_chunk_heap.o
ion-alloc-$(CONFIG_ION_CMA_HEAP) += ion_cma_heap.o
+33 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/miscdevice.h>
#include <linux/mm.h>
#include <linux/mm_types.h>
#include <linux/module.h>
#include <linux/rbtree.h>
#include <linux/sched/task.h>
#include <linux/seq_file.h>
@@ -660,4 +661,36 @@ static int ion_device_create(void)
	kfree(idev);
	return ret;
}

#ifdef CONFIG_ION_MODULE
int ion_module_init(void)
{
	int ret;

	ret = ion_device_create();
#ifdef CONFIG_ION_SYSTEM_HEAP
	if (ret)
		return ret;

	ret = ion_system_heap_create();
	if (ret)
		return ret;

	ret = ion_system_contig_heap_create();
#endif
#ifdef CONFIG_ION_CMA_HEAP
	if (ret)
		return ret;

	ret = ion_add_cma_heaps();
#endif
	return ret;
}

module_init(ion_module_init);
#else
subsys_initcall(ion_device_create);
#endif

MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Ion memory allocator");
+5 −0
Original line number Diff line number Diff line
@@ -336,4 +336,9 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);

int ion_query_heaps(struct ion_heap_query *query);

#ifdef CONFIG_ION_MODULE
int ion_add_cma_heaps(void);
int ion_system_heap_create(void);
int ion_system_contig_heap_create(void);
#endif
#endif /* _ION_H */
+4 −1
Original line number Diff line number Diff line
@@ -134,9 +134,12 @@ static int __ion_add_cma_heaps(struct cma *cma, void *data)
	return 0;
}

static int ion_add_cma_heaps(void)
int ion_add_cma_heaps(void)
{
	cma_for_each_area(__ion_add_cma_heaps, NULL);
	return 0;
}

#ifndef CONFIG_ION_MODULE
device_initcall(ion_add_cma_heaps);
#endif
Loading