|
|
@@ -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;
|
|
|
|