drm: remove drm_{alloc,free}_pages
authorDave Airlie <airlied@linux.ie>
Tue, 28 Mar 2006 22:16:12 +0000 (08:16 +1000)
committerDave Airlie <airlied@linux.ie>
Tue, 28 Mar 2006 22:16:12 +0000 (08:16 +1000)
drm_alloc_pages and drm_free_pages can now be removed.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/drmP.h
drivers/char/drm/drm_memory.c
drivers/char/drm/drm_memory_debug.h

index dbe952f899c0f86790dcd823779134d7457199e6..edc72a6348a72301ceb2cf4f1b33816a8ee0e91b 100644 (file)
@@ -813,8 +813,6 @@ extern void drm_mem_init(void);
 extern int drm_mem_info(char *buf, char **start, off_t offset,
                        int request, int *eof, void *data);
 extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
 extern int drm_mem_info(char *buf, char **start, off_t offset,
                        int request, int *eof, void *data);
 extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
-extern unsigned long drm_alloc_pages(int order, int area);
-extern void drm_free_pages(unsigned long address, int order, int area);
 extern void *drm_ioremap(unsigned long offset, unsigned long size,
                         drm_device_t * dev);
 extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size,
 extern void *drm_ioremap(unsigned long offset, unsigned long size,
                         drm_device_t * dev);
 extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size,
index 8074771e348fd384598b259c748a67b23c99650b..dddf8de661433cc21758fc5f1b98d25c775f483c 100644 (file)
@@ -79,65 +79,6 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
        return pt;
 }
 
        return pt;
 }
 
-/**
- * Allocate pages.
- *
- * \param order size order.
- * \param area memory area. (Not used.)
- * \return page address on success, or zero on failure.
- *
- * Allocate and reserve free pages.
- */
-unsigned long drm_alloc_pages(int order, int area)
-{
-       unsigned long address;
-       unsigned long bytes = PAGE_SIZE << order;
-       unsigned long addr;
-       unsigned int sz;
-
-       address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
-       if (!address)
-               return 0;
-
-       /* Zero */
-       memset((void *)address, 0, bytes);
-
-       /* Reserve */
-       for (addr = address, sz = bytes;
-            sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
-               SetPageReserved(virt_to_page(addr));
-       }
-
-       return address;
-}
-
-/**
- * Free pages.
- *
- * \param address address of the pages to free.
- * \param order size order.
- * \param area memory area. (Not used.)
- *
- * Unreserve and free pages allocated by alloc_pages().
- */
-void drm_free_pages(unsigned long address, int order, int area)
-{
-       unsigned long bytes = PAGE_SIZE << order;
-       unsigned long addr;
-       unsigned int sz;
-
-       if (!address)
-               return;
-
-       /* Unreserve */
-       for (addr = address, sz = bytes;
-            sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
-               ClearPageReserved(virt_to_page(addr));
-       }
-
-       free_pages(address, order);
-}
-
 #if __OS_HAS_AGP
 /** Wrapper around agp_allocate_memory() */
 DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type)
 #if __OS_HAS_AGP
 /** Wrapper around agp_allocate_memory() */
 DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type)
index e84605fc54af09e8073cd3a99c399fc658b1cfd4..7868341817da2f538f55764eb14055d096ff4df8 100644 (file)
@@ -206,76 +206,6 @@ void drm_free (void *pt, size_t size, int area) {
        }
 }
 
        }
 }
 
-unsigned long drm_alloc_pages (int order, int area) {
-       unsigned long address;
-       unsigned long bytes = PAGE_SIZE << order;
-       unsigned long addr;
-       unsigned int sz;
-
-       spin_lock(&drm_mem_lock);
-       if ((drm_ram_used >> PAGE_SHIFT)
-           > (DRM_RAM_PERCENT * drm_ram_available) / 100) {
-               spin_unlock(&drm_mem_lock);
-               return 0;
-       }
-       spin_unlock(&drm_mem_lock);
-
-       address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
-       if (!address) {
-               spin_lock(&drm_mem_lock);
-               ++drm_mem_stats[area].fail_count;
-               spin_unlock(&drm_mem_lock);
-               return 0;
-       }
-       spin_lock(&drm_mem_lock);
-       ++drm_mem_stats[area].succeed_count;
-       drm_mem_stats[area].bytes_allocated += bytes;
-       drm_ram_used += bytes;
-       spin_unlock(&drm_mem_lock);
-
-       /* Zero outside the lock */
-       memset((void *)address, 0, bytes);
-
-       /* Reserve */
-       for (addr = address, sz = bytes;
-            sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
-               SetPageReserved(virt_to_page(addr));
-       }
-
-       return address;
-}
-
-void drm_free_pages (unsigned long address, int order, int area) {
-       unsigned long bytes = PAGE_SIZE << order;
-       int alloc_count;
-       int free_count;
-       unsigned long addr;
-       unsigned int sz;
-
-       if (!address) {
-               DRM_MEM_ERROR(area, "Attempt to free address 0\n");
-       } else {
-               /* Unreserve */
-               for (addr = address, sz = bytes;
-                    sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
-                       ClearPageReserved(virt_to_page(addr));
-               }
-               free_pages(address, order);
-       }
-
-       spin_lock(&drm_mem_lock);
-       free_count = ++drm_mem_stats[area].free_count;
-       alloc_count = drm_mem_stats[area].succeed_count;
-       drm_mem_stats[area].bytes_freed += bytes;
-       drm_ram_used -= bytes;
-       spin_unlock(&drm_mem_lock);
-       if (free_count > alloc_count) {
-               DRM_MEM_ERROR(area,
-                             "Excess frees: %d frees, %d allocs\n",
-                             free_count, alloc_count);
-       }
-}
-
 void *drm_ioremap (unsigned long offset, unsigned long size,
                    drm_device_t * dev) {
        void *pt;
 void *drm_ioremap (unsigned long offset, unsigned long size,
                    drm_device_t * dev) {
        void *pt;