Commit 507d256b authored by Dave Airlie's avatar Dave Airlie Committed by Dave Airlie

drm: ati_pcigart: simplify page_count manipulations

From: Nick Piggin <npiggin@suse.de>

Allocate a compound page for the user mapping instead of tweaking the page
refcounts.
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent f1e5c03d
...@@ -59,17 +59,16 @@ static void *drm_ati_alloc_pcigart_table(void) ...@@ -59,17 +59,16 @@ static void *drm_ati_alloc_pcigart_table(void)
int i; int i;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("%s\n", __FUNCTION__);
address = __get_free_pages(GFP_KERNEL, ATI_PCIGART_TABLE_ORDER); address = __get_free_pages(GFP_KERNEL | __GFP_COMP,
ATI_PCIGART_TABLE_ORDER);
if (address == 0UL) { if (address == 0UL) {
return NULL; return NULL;
} }
page = virt_to_page(address); page = virt_to_page(address);
for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++)
get_page(page);
SetPageReserved(page); SetPageReserved(page);
}
DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address);
return (void *)address; return (void *)address;
...@@ -83,10 +82,8 @@ static void drm_ati_free_pcigart_table(void *address) ...@@ -83,10 +82,8 @@ static void drm_ati_free_pcigart_table(void *address)
page = virt_to_page((unsigned long)address); page = virt_to_page((unsigned long)address);
for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++)
__put_page(page);
ClearPageReserved(page); ClearPageReserved(page);
}
free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment