summaryrefslogtreecommitdiff
path: root/shared-core/radeon_mem.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-08-30 09:01:50 +0000
committerDave Airlie <airlied@linux.ie>2004-08-30 09:01:50 +0000
commit7809efc8c32520e6b25c143ee3276edbf534ed14 (patch)
treecfa0ada45d368025b7506277fb4d2d22db243518 /shared-core/radeon_mem.c
parent08de6e5b04c1950a5f396315e59d2476726e26d8 (diff)
drm-memory patch, cleans up alloc/free and makes calloc look more libc like
Diffstat (limited to 'shared-core/radeon_mem.c')
-rw-r--r--shared-core/radeon_mem.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/shared-core/radeon_mem.c b/shared-core/radeon_mem.c
index 28995740..9d7fded7 100644
--- a/shared-core/radeon_mem.c
+++ b/shared-core/radeon_mem.c
@@ -44,7 +44,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
{
/* Maybe cut off the start of an existing block */
if (start > p->start) {
- struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock));
+ struct mem_block *newblock = DRM(alloc)(sizeof(*newblock), DRM_MEM_BUFS );
if (!newblock)
goto out;
newblock->start = start;
@@ -60,7 +60,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
/* Maybe cut off the end of an existing block */
if (size < p->size) {
- struct mem_block *newblock = DRM_MALLOC(sizeof(*newblock));
+ struct mem_block *newblock = DRM(alloc)(sizeof(*newblock), DRM_MEM_BUFS );
if (!newblock)
goto out;
newblock->start = start + size;
@@ -118,7 +118,7 @@ static void free_block( struct mem_block *p )
p->size += q->size;
p->next = q->next;
p->next->prev = p;
- DRM_FREE(q, sizeof(*q));
+ DRM(free)(q, sizeof(*q), DRM_MEM_BUFS );
}
if (p->prev->filp == 0) {
@@ -126,7 +126,7 @@ static void free_block( struct mem_block *p )
q->size += p->size;
q->next = p->next;
q->next->prev = q;
- DRM_FREE(p, sizeof(*q));
+ DRM(free)(p, sizeof(*q), DRM_MEM_BUFS );
}
}
@@ -134,14 +134,14 @@ static void free_block( struct mem_block *p )
*/
static int init_heap(struct mem_block **heap, int start, int size)
{
- struct mem_block *blocks = DRM_MALLOC(sizeof(*blocks));
+ struct mem_block *blocks = DRM(alloc)(sizeof(*blocks), DRM_MEM_BUFS );
if (!blocks)
return DRM_ERR(ENOMEM);
- *heap = DRM_MALLOC(sizeof(**heap));
+ *heap = DRM(alloc)(sizeof(**heap), DRM_MEM_BUFS );
if (!*heap) {
- DRM_FREE( blocks, sizeof(*blocks) );
+ DRM(free)( blocks, sizeof(*blocks), DRM_MEM_BUFS );
return DRM_ERR(ENOMEM);
}
@@ -180,7 +180,7 @@ void radeon_mem_release( DRMFILE filp, struct mem_block *heap )
p->size += q->size;
p->next = q->next;
p->next->prev = p;
- DRM_FREE(q, sizeof(*q));
+ DRM(free)(q, sizeof(*q),DRM_MEM_DRIVER);
}
}
}
@@ -197,10 +197,10 @@ void radeon_mem_takedown( struct mem_block **heap )
for (p = (*heap)->next ; p != *heap ; ) {
struct mem_block *q = p;
p = p->next;
- DRM_FREE(q, sizeof(*q));
+ DRM(free)(q, sizeof(*q),DRM_MEM_DRIVER);
}
- DRM_FREE( *heap, sizeof(**heap) );
+ DRM(free)( *heap, sizeof(**heap),DRM_MEM_DRIVER );
*heap = NULL;
}