diff options
author | Heesub Shin <heesub.shin@samsung.com> | 2014-05-30 01:26:28 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-06-19 22:38:33 (GMT) |
commit | 7eb88bffbd883fa78944799ff3887da916159a59 (patch) | |
tree | e0346d0fa19b20a124cc54c9d5334d63b8629654 /drivers/staging/android/ion | |
parent | d10e4ffd64a19d88f085e92a4b0a2470aa336915 (diff) | |
download | linux-7eb88bffbd883fa78944799ff3887da916159a59.tar.xz |
staging: ion: remove struct page_info
ION system heap creates a temporary list of pages to build
scatter/gather table, introducing an internal data type, page_info. Now
that the order field has been removed from it, we do not need to depend
on such data type anymore.
Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Reviewed-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android/ion')
-rw-r--r-- | drivers/staging/android/ion/ion_system_heap.c | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 621b857..f3b9008 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -52,11 +52,6 @@ struct ion_system_heap { struct ion_page_pool **pools; }; -struct page_info { - struct page *page; - struct list_head list; -}; - static struct page *alloc_buffer_page(struct ion_system_heap *heap, struct ion_buffer *buffer, unsigned long order) @@ -98,19 +93,14 @@ static void free_buffer_page(struct ion_system_heap *heap, } -static struct page_info *alloc_largest_available(struct ion_system_heap *heap, - struct ion_buffer *buffer, - unsigned long size, - unsigned int max_order) +static struct page *alloc_largest_available(struct ion_system_heap *heap, + struct ion_buffer *buffer, + unsigned long size, + unsigned int max_order) { struct page *page; - struct page_info *info; int i; - info = kmalloc(sizeof(struct page_info), GFP_KERNEL); - if (!info) - return NULL; - for (i = 0; i < num_orders; i++) { if (size < order_to_size(orders[i])) continue; @@ -121,10 +111,8 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap, if (!page) continue; - info->page = page; - return info; + return page; } - kfree(info); return NULL; } @@ -140,7 +128,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap, struct sg_table *table; struct scatterlist *sg; struct list_head pages; - struct page_info *info, *tmp_info; + struct page *page, *tmp_page; int i = 0; unsigned long size_remaining = PAGE_ALIGN(size); unsigned int max_order = orders[0]; @@ -153,13 +141,13 @@ static int ion_system_heap_allocate(struct ion_heap *heap, INIT_LIST_HEAD(&pages); while (size_remaining > 0) { - info = alloc_largest_available(sys_heap, buffer, size_remaining, + page = alloc_largest_available(sys_heap, buffer, size_remaining, max_order); - if (!info) + if (!page) goto free_pages; - list_add_tail(&info->list, &pages); - size_remaining -= PAGE_SIZE << compound_order(info->page); - max_order = compound_order(info->page); + list_add_tail(&page->lru, &pages); + size_remaining -= PAGE_SIZE << compound_order(page); + max_order = compound_order(page); i++; } table = kmalloc(sizeof(struct sg_table), GFP_KERNEL); @@ -170,12 +158,10 @@ static int ion_system_heap_allocate(struct ion_heap *heap, goto free_table; sg = table->sgl; - list_for_each_entry_safe(info, tmp_info, &pages, list) { - struct page *page = info->page; + list_for_each_entry_safe(page, tmp_page, &pages, lru) { sg_set_page(sg, page, PAGE_SIZE << compound_order(page), 0); sg = sg_next(sg); - list_del(&info->list); - kfree(info); + list_del(&page->lru); } buffer->priv_virt = table; @@ -184,11 +170,8 @@ static int ion_system_heap_allocate(struct ion_heap *heap, free_table: kfree(table); free_pages: - list_for_each_entry_safe(info, tmp_info, &pages, list) { - free_buffer_page(sys_heap, buffer, info->page, - compound_order(info->page)); - kfree(info); - } + list_for_each_entry_safe(page, tmp_page, &pages, lru) + free_buffer_page(sys_heap, buffer, page, compound_order(page)); return -ENOMEM; } |