mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 20:53:53 +08:00
staging: android: ion: Remove struct ion_platform_heap
Now that ION heap registration has been re-worked to not depend on board files or have a central heap register helper there is no need to have this data structure. Most of the fields are unused. Some heap creation helpers are still available that use this to define the a heap but only use 2 or 3 elements from this struct, just convert these to get supplied these values from the heap registrar directly. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6e42d12ce0
commit
c72f4e31c8
@ -21,29 +21,6 @@
|
||||
|
||||
#include "../uapi/ion.h"
|
||||
|
||||
/**
|
||||
* struct ion_platform_heap - defines a heap in the given platform
|
||||
* @type: type of the heap from ion_heap_type enum
|
||||
* @id: unique identifier for heap. When allocating higher numb ers
|
||||
* will be allocated from first. At allocation these are passed
|
||||
* as a bit mask and therefore can not exceed ION_NUM_HEAP_IDS.
|
||||
* @name: used for debug purposes
|
||||
* @base: base address of heap in physical memory if applicable
|
||||
* @size: size of the heap in bytes if applicable
|
||||
* @priv: private info passed from the board file
|
||||
*
|
||||
* Provided by the board file.
|
||||
*/
|
||||
struct ion_platform_heap {
|
||||
enum ion_heap_type type;
|
||||
unsigned int id;
|
||||
const char *name;
|
||||
phys_addr_t base;
|
||||
size_t size;
|
||||
phys_addr_t align;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ion_buffer - metadata for a particular buffer
|
||||
* @ref: reference count
|
||||
|
@ -103,17 +103,14 @@ static struct ion_heap_ops carveout_heap_ops = {
|
||||
.unmap_kernel = ion_heap_unmap_kernel,
|
||||
};
|
||||
|
||||
struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data)
|
||||
struct ion_heap *ion_carveout_heap_create(phys_addr_t base, size_t size)
|
||||
{
|
||||
struct ion_carveout_heap *carveout_heap;
|
||||
int ret;
|
||||
|
||||
struct page *page;
|
||||
size_t size;
|
||||
|
||||
page = pfn_to_page(PFN_DOWN(heap_data->base));
|
||||
size = heap_data->size;
|
||||
|
||||
page = pfn_to_page(PFN_DOWN(base));
|
||||
ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL));
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
@ -127,9 +124,8 @@ struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data)
|
||||
kfree(carveout_heap);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
carveout_heap->base = heap_data->base;
|
||||
gen_pool_add(carveout_heap->pool, carveout_heap->base, heap_data->size,
|
||||
-1);
|
||||
carveout_heap->base = base;
|
||||
gen_pool_add(carveout_heap->pool, carveout_heap->base, size, -1);
|
||||
carveout_heap->heap.ops = &carveout_heap_ops;
|
||||
carveout_heap->heap.type = ION_HEAP_TYPE_CARVEOUT;
|
||||
carveout_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
|
||||
|
@ -108,16 +108,13 @@ static struct ion_heap_ops chunk_heap_ops = {
|
||||
.unmap_kernel = ion_heap_unmap_kernel,
|
||||
};
|
||||
|
||||
struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
|
||||
struct ion_heap *ion_chunk_heap_create(phys_addr_t base, size_t size, size_t chunk_size)
|
||||
{
|
||||
struct ion_chunk_heap *chunk_heap;
|
||||
int ret;
|
||||
struct page *page;
|
||||
size_t size;
|
||||
|
||||
page = pfn_to_page(PFN_DOWN(heap_data->base));
|
||||
size = heap_data->size;
|
||||
|
||||
page = pfn_to_page(PFN_DOWN(base));
|
||||
ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL));
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
@ -126,23 +123,23 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
|
||||
if (!chunk_heap)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
chunk_heap->chunk_size = (unsigned long)heap_data->priv;
|
||||
chunk_heap->chunk_size = chunk_size;
|
||||
chunk_heap->pool = gen_pool_create(get_order(chunk_heap->chunk_size) +
|
||||
PAGE_SHIFT, -1);
|
||||
if (!chunk_heap->pool) {
|
||||
ret = -ENOMEM;
|
||||
goto error_gen_pool_create;
|
||||
}
|
||||
chunk_heap->base = heap_data->base;
|
||||
chunk_heap->size = heap_data->size;
|
||||
chunk_heap->base = base;
|
||||
chunk_heap->size = size;
|
||||
chunk_heap->allocated = 0;
|
||||
|
||||
gen_pool_add(chunk_heap->pool, chunk_heap->base, heap_data->size, -1);
|
||||
gen_pool_add(chunk_heap->pool, chunk_heap->base, size, -1);
|
||||
chunk_heap->heap.ops = &chunk_heap_ops;
|
||||
chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
|
||||
chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
|
||||
pr_debug("%s: base %pa size %zu\n", __func__,
|
||||
&chunk_heap->base, heap_data->size);
|
||||
&chunk_heap->base, size);
|
||||
|
||||
return &chunk_heap->heap;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user