Commit bd21080e authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/nvif: give every device object a human-readable identifier



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 9ac596a4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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*/
+3 −3
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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),
+4 −4
Original line number Diff line number Diff line
@@ -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;