Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753577Ab3EZNlw (ORCPT ); Sun, 26 May 2013 09:41:52 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:54241 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752899Ab3EZNlt (ORCPT ); Sun, 26 May 2013 09:41:49 -0400 From: Jiang Liu 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 Subject: [PATCH v8, part3 06/14] mm, acornfb: use free_reserved_area() to simplify code Date: Sun, 26 May 2013 21:38:34 +0800 Message-Id: <1369575522-26405-7-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1369575522-26405-1-git-send-email-jiang.liu@huawei.com> References: <1369575522-26405-1-git-send-email-jiang.liu@huawei.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2364 Lines: 82 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 | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 6488a73..8f7374f 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -1180,42 +1180,6 @@ static int acornfb_detect_monitortype(void) return 4; } -/* - * This enables the unused memory to be freed on older Acorn machines. - * We are freeing memory on behalf of the architecture initialisation - * code here. - */ -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); -} - static int acornfb_probe(struct platform_device *dev) { unsigned long size; @@ -1312,10 +1276,13 @@ static int acornfb_probe(struct platform_device *dev) #endif #if defined(HAS_VIDC) /* - * Archimedes/A5000 machines use a fixed address for their - * framebuffers. Free unused pages + * We are freeing memory on behalf of the architecture initialisation + * code here. Archimedes/A5000 machines use a fixed address for their + * framebuffers. */ - free_unused_pages(PAGE_OFFSET + size, PAGE_OFFSET + MAX_SIZE); + free_reserved_area((void *)(PAGE_OFFSET + size), + (void *)PAGE_ALIGN(PAGE_OFFSET + MAX_SIZE), + -1, "acornfb"); #endif fb_info.fix.smem_len = size; -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/