@@ -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;
Use common help function free_reserved_area() to simplify code. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/video/acornfb.c | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-)