From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiang Liu Subject: [PATCH v5, part3 07/15] mm, acornfb: use free_reserved_area() to simplify code Date: Wed, 8 May 2013 23:17:06 +0800 Message-ID: <1368026235-5976-8-git-send-email-jiang.liu@huawei.com> References: <1368026235-5976-1-git-send-email-jiang.liu@huawei.com> Return-path: In-Reply-To: <1368026235-5976-1-git-send-email-jiang.liu@huawei.com> Sender: owner-linux-mm@kvack.org To: Andrew Morton Cc: Jiang Liu , David Rientjes , Wen Congyang , Mel Gorman , Minchan Kim , KAMEZAWA Hiroyuki , Michal Hocko , James Bottomley , Sergei Shtylyov , David Howells , Mark Salter , Jianguo Wu , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Tobias Schandinat , linux-fbdev@vger.kernel.org List-Id: linux-arch.vger.kernel.org Use common help function free_reserved_area() to simplify code. Signed-off-by: Jiang Liu Cc: Florian Tobias Schandinat Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/video/acornfb.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 6488a73..344f2bb 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -1188,32 +1188,8 @@ static int acornfb_detect_monitortype(void) static inline void free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) { - int mb_freed = 0; - - /* - * Align addresses - */ - virtual_start = PAGE_ALIGN(virtual_start); - virtual_end = PAGE_ALIGN(virtual_end); - - while (virtual_start < virtual_end) { - struct page *page; - - /* - * Clear page reserved bit, - * set count to 1, and free - * the page. - */ - page = virt_to_page(virtual_start); - ClearPageReserved(page); - init_page_count(page); - free_page(virtual_start); - - virtual_start += PAGE_SIZE; - mb_freed += PAGE_SIZE / 1024; - } - - printk("acornfb: freed %dK memory\n", mb_freed); + free_reserved_area(virtual_start, PAGE_ALIGN(virtual_end), + -1, "acornfb"); } static int acornfb_probe(struct platform_device *dev) -- 1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-da0-f43.google.com ([209.85.210.43]:48157 "EHLO mail-da0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755144Ab3EHPTW (ORCPT ); Wed, 8 May 2013 11:19:22 -0400 From: Jiang Liu Subject: [PATCH v5, part3 07/15] mm, acornfb: use free_reserved_area() to simplify code Date: Wed, 8 May 2013 23:17:06 +0800 Message-ID: <1368026235-5976-8-git-send-email-jiang.liu@huawei.com> In-Reply-To: <1368026235-5976-1-git-send-email-jiang.liu@huawei.com> References: <1368026235-5976-1-git-send-email-jiang.liu@huawei.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andrew Morton Cc: Jiang Liu , David Rientjes , Wen Congyang , Mel Gorman , Minchan Kim , KAMEZAWA Hiroyuki , Michal Hocko , James Bottomley , Sergei Shtylyov , David Howells , Mark Salter , Jianguo Wu , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Tobias Schandinat , linux-fbdev@vger.kernel.org Message-ID: <20130508151706.9r6xoU0GnY-a7P9NxqrXMqILcL2_SLtXbnLj9Y61Rj4@z> Use common help function free_reserved_area() to simplify code. Signed-off-by: Jiang Liu Cc: Florian Tobias Schandinat Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/video/acornfb.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 6488a73..344f2bb 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -1188,32 +1188,8 @@ static int acornfb_detect_monitortype(void) static inline void free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) { - int mb_freed = 0; - - /* - * Align addresses - */ - virtual_start = PAGE_ALIGN(virtual_start); - virtual_end = PAGE_ALIGN(virtual_end); - - while (virtual_start < virtual_end) { - struct page *page; - - /* - * Clear page reserved bit, - * set count to 1, and free - * the page. - */ - page = virt_to_page(virtual_start); - ClearPageReserved(page); - init_page_count(page); - free_page(virtual_start); - - virtual_start += PAGE_SIZE; - mb_freed += PAGE_SIZE / 1024; - } - - printk("acornfb: freed %dK memory\n", mb_freed); + free_reserved_area(virtual_start, PAGE_ALIGN(virtual_end), + -1, "acornfb"); } static int acornfb_probe(struct platform_device *dev) -- 1.7.9.5