From: Dave Airlie Date: Wed, 25 Jan 2006 03:58:58 +0000 (+1100) Subject: drm: ati_pcigart: simplify page_count manipulations X-Git-Tag: v2.6.16-rc2~1^2~5^2~4 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=507d256bae9eef7acd5049af6e3f67c24904a1e4;p=linux-2.6 drm: ati_pcigart: simplify page_count manipulations From: Nick Piggin Allocate a compound page for the user mapping instead of tweaking the page refcounts. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Dave Airlie --- diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index 7d2a885b5d..bd7be09ea5 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c @@ -59,17 +59,16 @@ static void *drm_ati_alloc_pcigart_table(void) int i; 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) { return NULL; } page = virt_to_page(address); - for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { - get_page(page); + for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) SetPageReserved(page); - } DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); return (void *)address; @@ -83,10 +82,8 @@ static void drm_ati_free_pcigart_table(void *address) page = virt_to_page((unsigned long)address); - for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { - __put_page(page); + for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) ClearPageReserved(page); - } free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); }