drm/nouveau: fix display takedown order to match reverse init order
authorBen Skeggs <bskeggs@redhat.com>
Wed, 8 Jun 2011 08:29:12 +0000 (18:29 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 23 Jun 2011 06:01:47 +0000 (16:01 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_state.c

index 50507e7..27d2a81 100644 (file)
@@ -720,11 +720,16 @@ static void nouveau_card_takedown(struct drm_device *dev)
        struct nouveau_engine *engine = &dev_priv->engine;
        int e;
 
+       drm_kms_helper_poll_fini(dev);
+       nouveau_fbcon_fini(dev);
+
        if (dev_priv->channel) {
-               nouveau_fence_fini(dev);
                nouveau_channel_put_unlocked(&dev_priv->channel);
+               nouveau_fence_fini(dev);
        }
 
+       engine->display.destroy(dev);
+
        if (!dev_priv->noaccel) {
                engine->fifo.takedown(dev);
                for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
@@ -1063,11 +1068,7 @@ void nouveau_lastclose(struct drm_device *dev)
 int nouveau_unload(struct drm_device *dev)
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
-       struct nouveau_engine *engine = &dev_priv->engine;
 
-       drm_kms_helper_poll_fini(dev);
-       nouveau_fbcon_fini(dev);
-       engine->display.destroy(dev);
        nouveau_card_takedown(dev);
 
        iounmap(dev_priv->mmio);