From: Heesub Shin Date: Wed, 28 May 2014 06:52:53 +0000 (+0900) Subject: staging: ion: simplify ion_page_pool_total() X-Git-Tag: firefly_0821_release~176^2~3465^2~39^2~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=80cb77dc6310a72002f6cb8255316c5aaea78807;p=firefly-linux-kernel-4.4.55.git staging: ion: simplify ion_page_pool_total() ion_page_pool_total() returns the total number of pages in the pool. Depending on the argument passed, it counts highmem pages in or not. This commit simplifies the code lines for better readability. Signed-off-by: Heesub Shin Reviewed-by: Mitchel Humpherys Tested-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index ead405458c75..168478077cb8 100644 --- a/drivers/staging/android/ion/ion_page_pool.c +++ b/drivers/staging/android/ion/ion_page_pool.c @@ -119,12 +119,12 @@ void ion_page_pool_free(struct ion_page_pool *pool, struct page *page) static int ion_page_pool_total(struct ion_page_pool *pool, bool high) { - int total = 0; + int count = pool->low_count; - total += high ? (pool->high_count + pool->low_count) * - (1 << pool->order) : - pool->low_count * (1 << pool->order); - return total; + if (high) + count += pool->high_count; + + return count << pool->order; } int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,