Add NULLs instead of 0 for i915

main
Dave Airlie 2004-07-20 11:48:25 +00:00
parent 9266bf5301
commit b35cba47d5
2 changed files with 18 additions and 18 deletions

View File

@ -82,7 +82,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out; goto out;
newblock->start = start; newblock->start = start;
newblock->size = p->size - (start - p->start); newblock->size = p->size - (start - p->start);
newblock->filp = 0; newblock->filp = NULL;
newblock->next = p->next; newblock->next = p->next;
newblock->prev = p; newblock->prev = p;
p->next->prev = newblock; p->next->prev = newblock;
@ -98,7 +98,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out; goto out;
newblock->start = start + size; newblock->start = start + size;
newblock->size = p->size - size; newblock->size = p->size - size;
newblock->filp = 0; newblock->filp = NULL;
newblock->next = p->next; newblock->next = p->next;
newblock->prev = p; newblock->prev = p;
p->next->prev = newblock; p->next->prev = newblock;
@ -120,7 +120,7 @@ static struct mem_block *alloc_block( struct mem_block *heap, int size,
for (p = heap->next ; p != heap ; p = p->next) { for (p = heap->next ; p != heap ; p = p->next) {
int start = (p->start + mask) & ~mask; int start = (p->start + mask) & ~mask;
if (p->filp == 0 && start + size <= p->start + p->size) if (p->filp == NULL && start + size <= p->start + p->size)
return split_block( p, start, size, filp ); return split_block( p, start, size, filp );
} }
@ -141,12 +141,12 @@ static struct mem_block *find_block( struct mem_block *heap, int start )
static void free_block( struct mem_block *p ) static void free_block( struct mem_block *p )
{ {
p->filp = 0; p->filp = NULL;
/* Assumes a single contiguous range. Needs a special filp in /* Assumes a single contiguous range. Needs a special filp in
* 'heap' to stop it being subsumed. * 'heap' to stop it being subsumed.
*/ */
if (p->next->filp == 0) { if (p->next->filp == NULL) {
struct mem_block *q = p->next; struct mem_block *q = p->next;
p->size += q->size; p->size += q->size;
p->next = q->next; p->next = q->next;
@ -154,7 +154,7 @@ static void free_block( struct mem_block *p )
DRM_FREE(q, sizeof(*q)); DRM_FREE(q, sizeof(*q));
} }
if (p->prev->filp == 0) { if (p->prev->filp == NULL) {
struct mem_block *q = p->prev; struct mem_block *q = p->prev;
q->size += p->size; q->size += p->size;
q->next = p->next; q->next = p->next;
@ -180,7 +180,7 @@ static int init_heap(struct mem_block **heap, int start, int size)
blocks->start = start; blocks->start = start;
blocks->size = size; blocks->size = size;
blocks->filp = 0; blocks->filp = NULL;
blocks->next = blocks->prev = *heap; blocks->next = blocks->prev = *heap;
memset( *heap, 0, sizeof(**heap) ); memset( *heap, 0, sizeof(**heap) );
@ -202,7 +202,7 @@ void i915_mem_release( drm_device_t *dev,
for (p = heap->next ; p != heap ; p = p->next) { for (p = heap->next ; p != heap ; p = p->next) {
if (p->filp == filp) { if (p->filp == filp) {
p->filp = 0; p->filp = NULL;
mark_block( dev, p, 0 ); mark_block( dev, p, 0 );
} }
} }
@ -211,7 +211,7 @@ void i915_mem_release( drm_device_t *dev,
* 'heap' to stop it being subsumed. * 'heap' to stop it being subsumed.
*/ */
for (p = heap->next ; p != heap ; p = p->next) { for (p = heap->next ; p != heap ; p = p->next) {
while (p->filp == 0 && p->next->filp == 0) { while (p->filp == NULL && p->next->filp == NULL) {
struct mem_block *q = p->next; struct mem_block *q = p->next;
p->size += q->size; p->size += q->size;
p->next = q->next; p->next = q->next;

View File

@ -82,7 +82,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out; goto out;
newblock->start = start; newblock->start = start;
newblock->size = p->size - (start - p->start); newblock->size = p->size - (start - p->start);
newblock->filp = 0; newblock->filp = NULL;
newblock->next = p->next; newblock->next = p->next;
newblock->prev = p; newblock->prev = p;
p->next->prev = newblock; p->next->prev = newblock;
@ -98,7 +98,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out; goto out;
newblock->start = start + size; newblock->start = start + size;
newblock->size = p->size - size; newblock->size = p->size - size;
newblock->filp = 0; newblock->filp = NULL;
newblock->next = p->next; newblock->next = p->next;
newblock->prev = p; newblock->prev = p;
p->next->prev = newblock; p->next->prev = newblock;
@ -120,7 +120,7 @@ static struct mem_block *alloc_block( struct mem_block *heap, int size,
for (p = heap->next ; p != heap ; p = p->next) { for (p = heap->next ; p != heap ; p = p->next) {
int start = (p->start + mask) & ~mask; int start = (p->start + mask) & ~mask;
if (p->filp == 0 && start + size <= p->start + p->size) if (p->filp == NULL && start + size <= p->start + p->size)
return split_block( p, start, size, filp ); return split_block( p, start, size, filp );
} }
@ -141,12 +141,12 @@ static struct mem_block *find_block( struct mem_block *heap, int start )
static void free_block( struct mem_block *p ) static void free_block( struct mem_block *p )
{ {
p->filp = 0; p->filp = NULL;
/* Assumes a single contiguous range. Needs a special filp in /* Assumes a single contiguous range. Needs a special filp in
* 'heap' to stop it being subsumed. * 'heap' to stop it being subsumed.
*/ */
if (p->next->filp == 0) { if (p->next->filp == NULL) {
struct mem_block *q = p->next; struct mem_block *q = p->next;
p->size += q->size; p->size += q->size;
p->next = q->next; p->next = q->next;
@ -154,7 +154,7 @@ static void free_block( struct mem_block *p )
DRM_FREE(q, sizeof(*q)); DRM_FREE(q, sizeof(*q));
} }
if (p->prev->filp == 0) { if (p->prev->filp == NULL) {
struct mem_block *q = p->prev; struct mem_block *q = p->prev;
q->size += p->size; q->size += p->size;
q->next = p->next; q->next = p->next;
@ -180,7 +180,7 @@ static int init_heap(struct mem_block **heap, int start, int size)
blocks->start = start; blocks->start = start;
blocks->size = size; blocks->size = size;
blocks->filp = 0; blocks->filp = NULL;
blocks->next = blocks->prev = *heap; blocks->next = blocks->prev = *heap;
memset( *heap, 0, sizeof(**heap) ); memset( *heap, 0, sizeof(**heap) );
@ -202,7 +202,7 @@ void i915_mem_release( drm_device_t *dev,
for (p = heap->next ; p != heap ; p = p->next) { for (p = heap->next ; p != heap ; p = p->next) {
if (p->filp == filp) { if (p->filp == filp) {
p->filp = 0; p->filp = NULL;
mark_block( dev, p, 0 ); mark_block( dev, p, 0 );
} }
} }
@ -211,7 +211,7 @@ void i915_mem_release( drm_device_t *dev,
* 'heap' to stop it being subsumed. * 'heap' to stop it being subsumed.
*/ */
for (p = heap->next ; p != heap ; p = p->next) { for (p = heap->next ; p != heap ; p = p->next) {
while (p->filp == 0 && p->next->filp == 0) { while (p->filp == NULL && p->next->filp == NULL) {
struct mem_block *q = p->next; struct mem_block *q = p->next;
p->size += q->size; p->size += q->size;
p->next = q->next; p->next = q->next;