staging: ion: make system and contig heaps modular
Add symmetric heap add/remove APIs and export symbols from ion core that are needed to make both heaps modular. Bug: 133508579 Test: ion-unit-test, rmmod, modprobe Change-Id: Ic5f40936531936c9bfab48ea147108c019d28e2c Signed-off-by: Sandeep Patil <sspatil@google.com>
This commit is contained in:

committed by
Alistair Delva

parent
ef87819967
commit
d872160f11
@@ -12,6 +12,7 @@
|
||||
#include <linux/dma-direction.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mm_types.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/sched.h>
|
||||
@@ -105,6 +106,7 @@ struct ion_heap_ops {
|
||||
* allocating. These are specified by platform data and
|
||||
* MUST be unique
|
||||
* @name: used for debugging
|
||||
* @owner: kernel module that implements this heap
|
||||
* @shrinker: a shrinker for the heap
|
||||
* @free_list: free list head if deferred free is used
|
||||
* @free_list_size size of the deferred free list in bytes
|
||||
@@ -127,6 +129,7 @@ struct ion_heap {
|
||||
unsigned long flags;
|
||||
unsigned int id;
|
||||
const char *name;
|
||||
struct module *owner;
|
||||
|
||||
/* deferred free support */
|
||||
struct shrinker shrinker;
|
||||
@@ -143,16 +146,30 @@ struct ion_heap {
|
||||
|
||||
/* protect heap statistics */
|
||||
spinlock_t stat_lock;
|
||||
|
||||
/* heap's debugfs root */
|
||||
struct dentry *debugfs_dir;
|
||||
};
|
||||
|
||||
#define ion_device_add_heap(heap) __ion_device_add_heap(heap, THIS_MODULE)
|
||||
|
||||
#ifdef CONFIG_ION
|
||||
|
||||
/**
|
||||
* ion_device_add_heap - adds a heap to the ion device
|
||||
* __ion_device_add_heap - adds a heap to the ion device
|
||||
*
|
||||
* @heap: the heap to add
|
||||
*
|
||||
* Returns 0 on success, negative error otherwise.
|
||||
*/
|
||||
void ion_device_add_heap(struct ion_heap *heap);
|
||||
int __ion_device_add_heap(struct ion_heap *heap, struct module *owner);
|
||||
|
||||
/**
|
||||
* ion_device_remove_heap - removes a heap from ion device
|
||||
*
|
||||
* @heap: pointer to the heap to be removed
|
||||
*/
|
||||
void ion_device_remove_heap(struct ion_heap *heap);
|
||||
|
||||
/**
|
||||
* ion_heap_init_shrinker
|
||||
@@ -283,7 +300,8 @@ struct dma_buf *ion_alloc(size_t len, unsigned int heap_id_mask,
|
||||
|
||||
#else
|
||||
|
||||
static inline int ion_device_add_heap(struct ion_heap *heap)
|
||||
static inline int __ion_device_add_heap(struct ion_heap *heap,
|
||||
struct module *owner)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
Reference in New Issue
Block a user