aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-02-18 11:59:11 -0500
committerDave Airlie <airlied@redhat.com>2011-02-22 19:18:20 -0500
commit31a5b8ce8f3bf20799eb68da9602de2bee58fdd3 (patch)
tree59e1c0b9cf8b63ebcb6ca9607c6cc6610ad8c388
parenta250b9fdc53a286d32e22f21170382a46b3a3ef5 (diff)
drm/nouveau: don't munge in drm_mm internals
Nouveau was checking drm_mm internals on teardown to see whether the memory manager was initialized. Hide these internals in a small inline helper function. Acked-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_object.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv50_instmem.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_instmem.c2
-rw-r--r--include/drm/drm_mm.h5
4 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c
index 30b6544467ca..03adfe4c7665 100644
--- a/drivers/gpu/drm/nouveau/nouveau_object.c
+++ b/drivers/gpu/drm/nouveau/nouveau_object.c
@@ -909,7 +909,7 @@ nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan)
909 nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); 909 nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd);
910 nouveau_gpuobj_ref(NULL, &chan->vm_pd); 910 nouveau_gpuobj_ref(NULL, &chan->vm_pd);
911 911
912 if (chan->ramin_heap.free_stack.next) 912 if (drm_mm_initialized(&chan->ramin_heap))
913 drm_mm_takedown(&chan->ramin_heap); 913 drm_mm_takedown(&chan->ramin_heap);
914 nouveau_gpuobj_ref(NULL, &chan->ramin); 914 nouveau_gpuobj_ref(NULL, &chan->ramin);
915} 915}
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c
index ea0041810ae3..300285ae8e9e 100644
--- a/drivers/gpu/drm/nouveau/nv50_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv50_instmem.c
@@ -56,7 +56,7 @@ nv50_channel_del(struct nouveau_channel **pchan)
56 nouveau_gpuobj_ref(NULL, &chan->ramfc); 56 nouveau_gpuobj_ref(NULL, &chan->ramfc);
57 nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); 57 nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd);
58 nouveau_gpuobj_ref(NULL, &chan->vm_pd); 58 nouveau_gpuobj_ref(NULL, &chan->vm_pd);
59 if (chan->ramin_heap.free_stack.next) 59 if (drm_mm_initialized(&chan->ramin_heap))
60 drm_mm_takedown(&chan->ramin_heap); 60 drm_mm_takedown(&chan->ramin_heap);
61 nouveau_gpuobj_ref(NULL, &chan->ramin); 61 nouveau_gpuobj_ref(NULL, &chan->ramin);
62 kfree(chan); 62 kfree(chan);
@@ -259,7 +259,7 @@ nv50_instmem_takedown(struct drm_device *dev)
259 nouveau_gpuobj_ref(NULL, &dev_priv->bar3_vm->pgt[0].obj[0]); 259 nouveau_gpuobj_ref(NULL, &dev_priv->bar3_vm->pgt[0].obj[0]);
260 nouveau_vm_ref(NULL, &dev_priv->bar3_vm, NULL); 260 nouveau_vm_ref(NULL, &dev_priv->bar3_vm, NULL);
261 261
262 if (dev_priv->ramin_heap.free_stack.next) 262 if (drm_mm_initialized(&dev_priv->ramin_heap))
263 drm_mm_takedown(&dev_priv->ramin_heap); 263 drm_mm_takedown(&dev_priv->ramin_heap);
264 264
265 dev_priv->engine.instmem.priv = NULL; 265 dev_priv->engine.instmem.priv = NULL;
diff --git a/drivers/gpu/drm/nouveau/nvc0_instmem.c b/drivers/gpu/drm/nouveau/nvc0_instmem.c
index c09091749054..82357d2df1f4 100644
--- a/drivers/gpu/drm/nouveau/nvc0_instmem.c
+++ b/drivers/gpu/drm/nouveau/nvc0_instmem.c
@@ -67,7 +67,7 @@ nvc0_channel_del(struct nouveau_channel **pchan)
67 return; 67 return;
68 68
69 nouveau_vm_ref(NULL, &chan->vm, NULL); 69 nouveau_vm_ref(NULL, &chan->vm, NULL);
70 if (chan->ramin_heap.free_stack.next) 70 if (drm_mm_initialized(&chan->ramin_heap))
71 drm_mm_takedown(&chan->ramin_heap); 71 drm_mm_takedown(&chan->ramin_heap);
72 nouveau_gpuobj_ref(NULL, &chan->ramin); 72 nouveau_gpuobj_ref(NULL, &chan->ramin);
73 kfree(chan); 73 kfree(chan);
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index e39177778601..0d791462f7b2 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -72,6 +72,11 @@ struct drm_mm {
72 unsigned long scan_end; 72 unsigned long scan_end;
73}; 73};
74 74
75static inline bool drm_mm_initialized(struct drm_mm *mm)
76{
77 return mm->free_stack.next;
78}
79
75/* 80/*
76 * Basic range manager support (drm_mm.c) 81 * Basic range manager support (drm_mm.c)
77 */ 82 */