diff options
author | Colin Cross <ccross@android.com> | 2013-11-27 15:51:02 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2013-12-12 15:27:14 -0800 |
commit | 049ca90450f8de6bff6c326d6c20ba2959db2e00 (patch) | |
tree | 8a158adb245333b03a901ed3cba4d78537d61022 /drivers/staging/android/ion/ion_carveout_heap.c | |
parent | 1ebba641fb19e38541e30666de8f26b7971949dc (diff) |
ion: add helper to zero contiguous region of pages
Add ion_heap_pages_zero for ion heaps to use to zero pages
during initialization or allocation, when a struct ion_buffer
may not be available. Use it from the chunk heap and carveout
heaps.
Change-Id: Ic6c921943a8820cf9896da5164f2d9794d0fe91f
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'drivers/staging/android/ion/ion_carveout_heap.c')
-rw-r--r-- | drivers/staging/android/ion/ion_carveout_heap.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c index 3f0e5a08fcf..5165de2ce34 100644 --- a/drivers/staging/android/ion/ion_carveout_heap.c +++ b/drivers/staging/android/ion/ion_carveout_heap.c @@ -150,6 +150,19 @@ static struct ion_heap_ops carveout_heap_ops = { 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) |