OSDN Git Service

drm/nouveau/nvif: give every device object a human-readable identifier
authorBen Skeggs <bskeggs@redhat.com>
Mon, 30 Mar 2020 03:49:05 +0000 (13:49 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 24 Jul 2020 08:50:50 +0000 (18:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/device.h
drivers/gpu/drm/nouveau/nouveau_abi16.c
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nvif/device.c

index c2a572c..b0e5980 100644 (file)
@@ -18,9 +18,9 @@ struct nvif_device {
        struct nvif_user user;
 };
 
-int  nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
-                     struct nvif_device *);
-void nvif_device_fini(struct nvif_device *);
+int  nvif_device_ctor(struct nvif_object *, const char *name, u32 handle,
+                     s32 oclass, void *, u32, struct nvif_device *);
+void nvif_device_dtor(struct nvif_device *);
 u64  nvif_device_time(struct nvif_device *);
 
 /*XXX*/
index ace302d..21537ca 100644 (file)
@@ -55,8 +55,8 @@ nouveau_abi16(struct drm_file *file_priv)
                         * device (ie. the one that belongs to the fd it
                         * opened)
                         */
-                       if (nvif_device_init(&cli->base.object, 0, NV_DEVICE,
-                                            &args, sizeof(args),
+                       if (nvif_device_ctor(&cli->base.object, "abi16Device",
+                                            0, NV_DEVICE, &args, sizeof(args),
                                             &abi16->device) == 0)
                                return cli->abi16;
 
@@ -167,7 +167,7 @@ nouveau_abi16_fini(struct nouveau_abi16 *abi16)
        }
 
        /* destroy the device object */
-       nvif_device_fini(&abi16->device);
+       nvif_device_dtor(&abi16->device);
 
        kfree(cli->abi16);
        cli->abi16 = NULL;
index 97604bd..ed8fbc6 100644 (file)
@@ -179,7 +179,7 @@ nouveau_cli_fini(struct nouveau_cli *cli)
        nouveau_vmm_fini(&cli->svm);
        nouveau_vmm_fini(&cli->vmm);
        nvif_mmu_fini(&cli->mmu);
-       nvif_device_fini(&cli->device);
+       nvif_device_dtor(&cli->device);
        mutex_lock(&cli->drm->master.lock);
        nvif_client_dtor(&cli->base);
        mutex_unlock(&cli->drm->master.lock);
@@ -238,7 +238,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
                goto done;
        }
 
-       ret = nvif_device_init(&cli->base.object, 0, NV_DEVICE,
+       ret = nvif_device_ctor(&cli->base.object, "drmDevice", 0, NV_DEVICE,
                               &(struct nv_device_v0) {
                                        .device = ~0,
                               }, sizeof(struct nv_device_v0),
index e801c4d..a3aebf8 100644 (file)
@@ -39,7 +39,7 @@ nvif_device_time(struct nvif_device *device)
 }
 
 void
-nvif_device_fini(struct nvif_device *device)
+nvif_device_dtor(struct nvif_device *device)
 {
        nvif_user_fini(device);
        kfree(device->runlist);
@@ -48,10 +48,10 @@ nvif_device_fini(struct nvif_device *device)
 }
 
 int
-nvif_device_init(struct nvif_object *parent, u32 handle, s32 oclass,
-                void *data, u32 size, struct nvif_device *device)
+nvif_device_ctor(struct nvif_object *parent, const char *name, u32 handle,
+                s32 oclass, void *data, u32 size, struct nvif_device *device)
 {
-       int ret = nvif_object_ctor(parent, "nvifDevice", handle,
+       int ret = nvif_object_ctor(parent, name ? name : "nvifDevice", handle,
                                   oclass, data, size, &device->object);
        device->runlist = NULL;
        device->user.func = NULL;