[PATCH 5/9] staging: ion: remove order from struct page_info

2014-05-26 Thread Heesub Shin
ION system heap uses an internal data structure, struct page_info, for
tracking down the meta information of the pages allocated from the pool.
Now that the pool returns compound pages, we don't need to store page
order in struct page_info.

Signed-off-by: Heesub Shin 
---
 drivers/staging/android/ion/ion_system_heap.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 48e6a58..73a2e67 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -53,7 +53,6 @@ struct ion_system_heap {
 
 struct page_info {
struct page *page;
-   unsigned int order;
struct list_head list;
 };
 
@@ -121,7 +120,6 @@ static struct page_info *alloc_largest_available(struct 
ion_system_heap *heap,
continue;
 
info->page = page;
-   info->order = orders[i];
return info;
}
kfree(info);
@@ -158,8 +156,8 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
if (!info)
goto free_pages;
list_add_tail(>list, );
-   size_remaining -= PAGE_SIZE << info->order;
-   max_order = info->order;
+   size_remaining -= PAGE_SIZE << compound_order(info->page);
+   max_order = compound_order(info->page);
i++;
}
table = kzalloc(sizeof(struct sg_table), GFP_KERNEL);
@@ -172,7 +170,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
sg = table->sgl;
list_for_each_entry_safe(info, tmp_info, , list) {
struct page *page = info->page;
-   sg_set_page(sg, page, PAGE_SIZE << info->order, 0);
+   sg_set_page(sg, page, PAGE_SIZE << compound_order(page), 0);
sg = sg_next(sg);
list_del(>list);
kfree(info);
@@ -185,7 +183,8 @@ free_table:
kfree(table);
 free_pages:
list_for_each_entry_safe(info, tmp_info, , list) {
-   free_buffer_page(sys_heap, buffer, info->page, info->order);
+   free_buffer_page(sys_heap, buffer, info->page,
+   compound_order(info->page));
kfree(info);
}
return -ENOMEM;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/9] staging: ion: remove order from struct page_info

2014-05-26 Thread Heesub Shin
ION system heap uses an internal data structure, struct page_info, for
tracking down the meta information of the pages allocated from the pool.
Now that the pool returns compound pages, we don't need to store page
order in struct page_info.

Signed-off-by: Heesub Shin heesub.s...@samsung.com
---
 drivers/staging/android/ion/ion_system_heap.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index 48e6a58..73a2e67 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -53,7 +53,6 @@ struct ion_system_heap {
 
 struct page_info {
struct page *page;
-   unsigned int order;
struct list_head list;
 };
 
@@ -121,7 +120,6 @@ static struct page_info *alloc_largest_available(struct 
ion_system_heap *heap,
continue;
 
info-page = page;
-   info-order = orders[i];
return info;
}
kfree(info);
@@ -158,8 +156,8 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
if (!info)
goto free_pages;
list_add_tail(info-list, pages);
-   size_remaining -= PAGE_SIZE  info-order;
-   max_order = info-order;
+   size_remaining -= PAGE_SIZE  compound_order(info-page);
+   max_order = compound_order(info-page);
i++;
}
table = kzalloc(sizeof(struct sg_table), GFP_KERNEL);
@@ -172,7 +170,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
sg = table-sgl;
list_for_each_entry_safe(info, tmp_info, pages, list) {
struct page *page = info-page;
-   sg_set_page(sg, page, PAGE_SIZE  info-order, 0);
+   sg_set_page(sg, page, PAGE_SIZE  compound_order(page), 0);
sg = sg_next(sg);
list_del(info-list);
kfree(info);
@@ -185,7 +183,8 @@ free_table:
kfree(table);
 free_pages:
list_for_each_entry_safe(info, tmp_info, pages, list) {
-   free_buffer_page(sys_heap, buffer, info-page, info-order);
+   free_buffer_page(sys_heap, buffer, info-page,
+   compound_order(info-page));
kfree(info);
}
return -ENOMEM;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/