diff options
author | Dave Airlie <airlied@linux.ie> | 2006-03-28 17:16:12 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-03-28 17:16:12 -0500 |
commit | 55eb061326765b2d0489387cfb3fc7dbd244f917 (patch) | |
tree | 7b86a46c2c0d9a1581f70dfd82067daaf566b16f /drivers | |
parent | d2b58b58838159b2afdc624f74b208e8bd3c029e (diff) |
drm: remove drm_{alloc,free}_pages
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/drm/drmP.h | 2 | ||||
-rw-r--r-- | drivers/char/drm/drm_memory.c | 59 | ||||
-rw-r--r-- | drivers/char/drm/drm_memory_debug.h | 70 |
3 files changed, 0 insertions, 131 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index dbe952f899c0..edc72a6348a7 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -813,8 +813,6 @@ extern void drm_mem_init(void); | |||
813 | extern int drm_mem_info(char *buf, char **start, off_t offset, | 813 | extern int drm_mem_info(char *buf, char **start, off_t offset, |
814 | int request, int *eof, void *data); | 814 | int request, int *eof, void *data); |
815 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); | 815 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); |
816 | extern unsigned long drm_alloc_pages(int order, int area); | ||
817 | extern void drm_free_pages(unsigned long address, int order, int area); | ||
818 | extern void *drm_ioremap(unsigned long offset, unsigned long size, | 816 | extern void *drm_ioremap(unsigned long offset, unsigned long size, |
819 | drm_device_t * dev); | 817 | drm_device_t * dev); |
820 | extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, | 818 | extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, |
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c index 8074771e348f..dddf8de66143 100644 --- a/drivers/char/drm/drm_memory.c +++ b/drivers/char/drm/drm_memory.c | |||
@@ -79,65 +79,6 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area) | |||
79 | return pt; | 79 | return pt; |
80 | } | 80 | } |
81 | 81 | ||
82 | /** | ||
83 | * Allocate pages. | ||
84 | * | ||
85 | * \param order size order. | ||
86 | * \param area memory area. (Not used.) | ||
87 | * \return page address on success, or zero on failure. | ||
88 | * | ||
89 | * Allocate and reserve free pages. | ||
90 | */ | ||
91 | unsigned long drm_alloc_pages(int order, int area) | ||
92 | { | ||
93 | unsigned long address; | ||
94 | unsigned long bytes = PAGE_SIZE << order; | ||
95 | unsigned long addr; | ||
96 | unsigned int sz; | ||
97 | |||
98 | address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); | ||
99 | if (!address) | ||
100 | return 0; | ||
101 | |||
102 | /* Zero */ | ||
103 | memset((void *)address, 0, bytes); | ||
104 | |||
105 | /* Reserve */ | ||
106 | for (addr = address, sz = bytes; | ||
107 | sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { | ||
108 | SetPageReserved(virt_to_page(addr)); | ||
109 | } | ||
110 | |||
111 | return address; | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * Free pages. | ||
116 | * | ||
117 | * \param address address of the pages to free. | ||
118 | * \param order size order. | ||
119 | * \param area memory area. (Not used.) | ||
120 | * | ||
121 | * Unreserve and free pages allocated by alloc_pages(). | ||
122 | */ | ||
123 | void drm_free_pages(unsigned long address, int order, int area) | ||
124 | { | ||
125 | unsigned long bytes = PAGE_SIZE << order; | ||
126 | unsigned long addr; | ||
127 | unsigned int sz; | ||
128 | |||
129 | if (!address) | ||
130 | return; | ||
131 | |||
132 | /* Unreserve */ | ||
133 | for (addr = address, sz = bytes; | ||
134 | sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { | ||
135 | ClearPageReserved(virt_to_page(addr)); | ||
136 | } | ||
137 | |||
138 | free_pages(address, order); | ||
139 | } | ||
140 | |||
141 | #if __OS_HAS_AGP | 82 | #if __OS_HAS_AGP |
142 | /** Wrapper around agp_allocate_memory() */ | 83 | /** Wrapper around agp_allocate_memory() */ |
143 | DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type) | 84 | DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type) |
diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h index e84605fc54af..7868341817da 100644 --- a/drivers/char/drm/drm_memory_debug.h +++ b/drivers/char/drm/drm_memory_debug.h | |||
@@ -206,76 +206,6 @@ void drm_free (void *pt, size_t size, int area) { | |||
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | unsigned long drm_alloc_pages (int order, int area) { | ||
210 | unsigned long address; | ||
211 | unsigned long bytes = PAGE_SIZE << order; | ||
212 | unsigned long addr; | ||
213 | unsigned int sz; | ||
214 | |||
215 | spin_lock(&drm_mem_lock); | ||
216 | if ((drm_ram_used >> PAGE_SHIFT) | ||
217 | > (DRM_RAM_PERCENT * drm_ram_available) / 100) { | ||
218 | spin_unlock(&drm_mem_lock); | ||
219 | return 0; | ||
220 | } | ||
221 | spin_unlock(&drm_mem_lock); | ||
222 | |||
223 | address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); | ||
224 | if (!address) { | ||
225 | spin_lock(&drm_mem_lock); | ||
226 | ++drm_mem_stats[area].fail_count; | ||
227 | spin_unlock(&drm_mem_lock); | ||
228 | return 0; | ||
229 | } | ||
230 | spin_lock(&drm_mem_lock); | ||
231 | ++drm_mem_stats[area].succeed_count; | ||
232 | drm_mem_stats[area].bytes_allocated += bytes; | ||
233 | drm_ram_used += bytes; | ||
234 | spin_unlock(&drm_mem_lock); | ||
235 | |||
236 | /* Zero outside the lock */ | ||
237 | memset((void *)address, 0, bytes); | ||
238 | |||
239 | /* Reserve */ | ||
240 | for (addr = address, sz = bytes; | ||
241 | sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { | ||
242 | SetPageReserved(virt_to_page(addr)); | ||
243 | } | ||
244 | |||
245 | return address; | ||
246 | } | ||
247 | |||
248 | void drm_free_pages (unsigned long address, int order, int area) { | ||
249 | unsigned long bytes = PAGE_SIZE << order; | ||
250 | int alloc_count; | ||
251 | int free_count; | ||
252 | unsigned long addr; | ||
253 | unsigned int sz; | ||
254 | |||
255 | if (!address) { | ||
256 | DRM_MEM_ERROR(area, "Attempt to free address 0\n"); | ||
257 | } else { | ||
258 | /* Unreserve */ | ||
259 | for (addr = address, sz = bytes; | ||
260 | sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { | ||
261 | ClearPageReserved(virt_to_page(addr)); | ||
262 | } | ||
263 | free_pages(address, order); | ||
264 | } | ||
265 | |||
266 | spin_lock(&drm_mem_lock); | ||
267 | free_count = ++drm_mem_stats[area].free_count; | ||
268 | alloc_count = drm_mem_stats[area].succeed_count; | ||
269 | drm_mem_stats[area].bytes_freed += bytes; | ||
270 | drm_ram_used -= bytes; | ||
271 | spin_unlock(&drm_mem_lock); | ||
272 | if (free_count > alloc_count) { | ||
273 | DRM_MEM_ERROR(area, | ||
274 | "Excess frees: %d frees, %d allocs\n", | ||
275 | free_count, alloc_count); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | void *drm_ioremap (unsigned long offset, unsigned long size, | 209 | void *drm_ioremap (unsigned long offset, unsigned long size, |
280 | drm_device_t * dev) { | 210 | drm_device_t * dev) { |
281 | void *pt; | 211 | void *pt; |