提交 31a5b8ce 编写于 作者: D Daniel Vetter 提交者: Dave Airlie

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: NBen Skeggs <bskeggs@redhat.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 a250b9fd
...@@ -909,7 +909,7 @@ nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan) ...@@ -909,7 +909,7 @@ nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan)
nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd);
nouveau_gpuobj_ref(NULL, &chan->vm_pd); nouveau_gpuobj_ref(NULL, &chan->vm_pd);
if (chan->ramin_heap.free_stack.next) if (drm_mm_initialized(&chan->ramin_heap))
drm_mm_takedown(&chan->ramin_heap); drm_mm_takedown(&chan->ramin_heap);
nouveau_gpuobj_ref(NULL, &chan->ramin); nouveau_gpuobj_ref(NULL, &chan->ramin);
} }
......
...@@ -56,7 +56,7 @@ nv50_channel_del(struct nouveau_channel **pchan) ...@@ -56,7 +56,7 @@ nv50_channel_del(struct nouveau_channel **pchan)
nouveau_gpuobj_ref(NULL, &chan->ramfc); nouveau_gpuobj_ref(NULL, &chan->ramfc);
nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd);
nouveau_gpuobj_ref(NULL, &chan->vm_pd); nouveau_gpuobj_ref(NULL, &chan->vm_pd);
if (chan->ramin_heap.free_stack.next) if (drm_mm_initialized(&chan->ramin_heap))
drm_mm_takedown(&chan->ramin_heap); drm_mm_takedown(&chan->ramin_heap);
nouveau_gpuobj_ref(NULL, &chan->ramin); nouveau_gpuobj_ref(NULL, &chan->ramin);
kfree(chan); kfree(chan);
...@@ -259,7 +259,7 @@ nv50_instmem_takedown(struct drm_device *dev) ...@@ -259,7 +259,7 @@ nv50_instmem_takedown(struct drm_device *dev)
nouveau_gpuobj_ref(NULL, &dev_priv->bar3_vm->pgt[0].obj[0]); nouveau_gpuobj_ref(NULL, &dev_priv->bar3_vm->pgt[0].obj[0]);
nouveau_vm_ref(NULL, &dev_priv->bar3_vm, NULL); nouveau_vm_ref(NULL, &dev_priv->bar3_vm, NULL);
if (dev_priv->ramin_heap.free_stack.next) if (drm_mm_initialized(&dev_priv->ramin_heap))
drm_mm_takedown(&dev_priv->ramin_heap); drm_mm_takedown(&dev_priv->ramin_heap);
dev_priv->engine.instmem.priv = NULL; dev_priv->engine.instmem.priv = NULL;
......
...@@ -67,7 +67,7 @@ nvc0_channel_del(struct nouveau_channel **pchan) ...@@ -67,7 +67,7 @@ nvc0_channel_del(struct nouveau_channel **pchan)
return; return;
nouveau_vm_ref(NULL, &chan->vm, NULL); nouveau_vm_ref(NULL, &chan->vm, NULL);
if (chan->ramin_heap.free_stack.next) if (drm_mm_initialized(&chan->ramin_heap))
drm_mm_takedown(&chan->ramin_heap); drm_mm_takedown(&chan->ramin_heap);
nouveau_gpuobj_ref(NULL, &chan->ramin); nouveau_gpuobj_ref(NULL, &chan->ramin);
kfree(chan); kfree(chan);
......
...@@ -72,6 +72,11 @@ struct drm_mm { ...@@ -72,6 +72,11 @@ struct drm_mm {
unsigned long scan_end; unsigned long scan_end;
}; };
static inline bool drm_mm_initialized(struct drm_mm *mm)
{
return mm->free_stack.next;
}
/* /*
* Basic range manager support (drm_mm.c) * Basic range manager support (drm_mm.c)
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册