参照元

説明

引数

返り値

参考

実装

struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data)
{
        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;
        ion_pages_sync_for_device(NULL, page, size, DMA_BIDIRECTIONAL);
        ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL));
        if (ret)
                return ERR_PTR(ret);
        carveout_heap = kzalloc(sizeof(struct ion_carveout_heap), GFP_KERNEL);
        if (!carveout_heap)
                return ERR_PTR(-ENOMEM);
        carveout_heap->pool = gen_pool_create(12, -1);
        if (!carveout_heap->pool) {
                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->heap.ops = &carveout_heap_ops;
        carveout_heap->heap.type = ION_HEAP_TYPE_CARVEOUT;
        carveout_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
        return &carveout_heap->heap;
}

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-03-09 (水) 17:00:00