drm/nouveau/core/client: destroy client objects over nvif
authorBen Skeggs <bskeggs@redhat.com>
Wed, 25 May 2016 07:02:11 +0000 (17:02 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 17 Feb 2017 05:14:59 +0000 (15:14 +1000)
Preparation for supporting subclients, and also good for consistency.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_nvif.c
drivers/gpu/drm/nouveau/nvif/client.c
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c

index 5219da4805b563fcd1ac62ae18afdeb3d5232f76..69341a65dc42bd5667cb4f13071f3ecf1be7b723 100644 (file)
@@ -71,15 +71,6 @@ nvkm_client_suspend(void *priv)
        return nvkm_object_fini(&client->object, true);
 }
 
-static void
-nvkm_client_driver_fini(void *priv)
-{
-       struct nvkm_client *client = priv;
-       struct nvkm_object *object = &client->object;
-       nvkm_object_fini(object, false);
-       nvkm_object_del(&object);
-}
-
 static int
 nvkm_client_ntfy(const void *header, u32 length, const void *data, u32 size)
 {
@@ -128,7 +119,6 @@ const struct nvif_driver
 nvif_driver_nvkm = {
        .name = "nvkm",
        .init = nvkm_client_driver_init,
-       .fini = nvkm_client_driver_fini,
        .suspend = nvkm_client_suspend,
        .resume = nvkm_client_resume,
        .ioctl = nvkm_client_ioctl,
index 29c20dfd894d585d29da3b8e9bad952b340f1aa7..ad1307b6f78385ef183ca199f077d47b093608b1 100644 (file)
@@ -47,11 +47,11 @@ nvif_client_resume(struct nvif_client *client)
 void
 nvif_client_fini(struct nvif_client *client)
 {
+       nvif_object_fini(&client->object);
        if (client->driver) {
-               client->driver->fini(client->object.priv);
+               if (client->driver->fini)
+                       client->driver->fini(client->object.priv);
                client->driver = NULL;
-               client->object.client = NULL;
-               nvif_object_fini(&client->object);
        }
 }
 
index 25c800b426ca5c25e1921c5161a7406b38af64ad..be19bbe56bba8d81ab47cd688724f580dfb86c46 100644 (file)
@@ -158,7 +158,7 @@ nvkm_ioctl_del(struct nvkm_client *client,
                nvkm_object_del(&object);
        }
 
-       return ret;
+       return ret ? ret : 1;
 }
 
 static int
@@ -441,12 +441,13 @@ nvkm_ioctl(struct nvkm_client *client, bool supervisor,
                                      &args->v0.route, &args->v0.token);
        }
 
-       nvif_ioctl(object, "return %d\n", ret);
-       if (hack) {
-               *hack = client->data;
-               client->data = NULL;
+       if (ret != 1) {
+               nvif_ioctl(object, "return %d\n", ret);
+               if (hack) {
+                       *hack = client->data;
+                       client->data = NULL;
+               }
        }
 
-       client->super = false;
        return ret;
 }