diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvif')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/client.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/device.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/disp.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/driver.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/mem.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/mmu.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/notify.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/object.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/user.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/vmm.c | 14 |
10 files changed, 69 insertions, 59 deletions
diff --git a/drivers/gpu/drm/nouveau/nvif/client.c b/drivers/gpu/drm/nouveau/nvif/client.c index 12db54965c20..12644f811b3e 100644 --- a/drivers/gpu/drm/nouveau/nvif/client.c +++ b/drivers/gpu/drm/nouveau/nvif/client.c @@ -48,9 +48,9 @@ nvif_client_resume(struct nvif_client *client) } void -nvif_client_fini(struct nvif_client *client) +nvif_client_dtor(struct nvif_client *client) { - nvif_object_fini(&client->object); + nvif_object_dtor(&client->object); if (client->driver) { if (client->driver->fini) client->driver->fini(client->object.priv); @@ -59,7 +59,7 @@ nvif_client_fini(struct nvif_client *client) } int -nvif_client_init(struct nvif_client *parent, const char *name, u64 device, +nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device, struct nvif_client *client) { struct nvif_client_v0 args = { .device = device }; @@ -70,8 +70,9 @@ nvif_client_init(struct nvif_client *parent, const char *name, u64 device, int ret; strncpy(args.name, name, sizeof(args.name)); - ret = nvif_object_init(parent != client ? &parent->object : NULL, - 0, NVIF_CLASS_CLIENT, &args, sizeof(args), + ret = nvif_object_ctor(parent != client ? &parent->object : NULL, + name ? name : "nvifClient", 0, + NVIF_CLASS_CLIENT, &args, sizeof(args), &client->object); if (ret) return ret; @@ -88,6 +89,6 @@ nvif_client_init(struct nvif_client *parent, const char *name, u64 device, } if (ret) - nvif_client_fini(client); + nvif_client_dtor(client); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvif/device.c b/drivers/gpu/drm/nouveau/nvif/device.c index 0e92db44bbc8..8c3d883f3313 100644 --- a/drivers/gpu/drm/nouveau/nvif/device.c +++ b/drivers/gpu/drm/nouveau/nvif/device.c @@ -39,20 +39,20 @@ 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); + nvif_user_dtor(device); kfree(device->runlist); device->runlist = NULL; - nvif_object_fini(&device->object); + nvif_object_dtor(&device->object); } 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_init(parent, handle, oclass, data, size, - &device->object); + int ret = nvif_object_ctor(parent, name ? name : "nvifDevice", handle, + oclass, data, size, &device->object); device->runlist = NULL; device->user.func = NULL; if (ret == 0) { diff --git a/drivers/gpu/drm/nouveau/nvif/disp.c b/drivers/gpu/drm/nouveau/nvif/disp.c index 61638b3b9d3d..8d0d30e08f57 100644 --- a/drivers/gpu/drm/nouveau/nvif/disp.c +++ b/drivers/gpu/drm/nouveau/nvif/disp.c @@ -27,11 +27,12 @@ void nvif_disp_dtor(struct nvif_disp *disp) { - nvif_object_fini(&disp->object); + nvif_object_dtor(&disp->object); } int -nvif_disp_ctor(struct nvif_device *device, s32 oclass, struct nvif_disp *disp) +nvif_disp_ctor(struct nvif_device *device, const char *name, s32 oclass, + struct nvif_disp *disp) { static const struct nvif_mclass disps[] = { { TU102_DISP, -1 }, @@ -56,6 +57,6 @@ nvif_disp_ctor(struct nvif_device *device, s32 oclass, struct nvif_disp *disp) if (cid < 0) return cid; - return nvif_object_init(&device->object, 0, disps[cid].oclass, - NULL, 0, &disp->object); + return nvif_object_ctor(&device->object, name ? name : "nvifDisp", 0, + disps[cid].oclass, NULL, 0, &disp->object); } diff --git a/drivers/gpu/drm/nouveau/nvif/driver.c b/drivers/gpu/drm/nouveau/nvif/driver.c index 701330956e33..5e00dd07afed 100644 --- a/drivers/gpu/drm/nouveau/nvif/driver.c +++ b/drivers/gpu/drm/nouveau/nvif/driver.c @@ -53,6 +53,6 @@ nvif_driver_init(const char *drv, const char *cfg, const char *dbg, } if (ret == 0) - ret = nvif_client_init(client, name, device, client); + ret = nvif_client_ctor(client, name, device, client); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvif/mem.c b/drivers/gpu/drm/nouveau/nvif/mem.c index b6ebb3b58673..0e1b7b4c2e91 100644 --- a/drivers/gpu/drm/nouveau/nvif/mem.c +++ b/drivers/gpu/drm/nouveau/nvif/mem.c @@ -25,27 +25,29 @@ #include <nvif/if000a.h> int -nvif_mem_init_map(struct nvif_mmu *mmu, u8 type, u64 size, struct nvif_mem *mem) +nvif_mem_ctor_map(struct nvif_mmu *mmu, const char *name, u8 type, u64 size, + struct nvif_mem *mem) { - int ret = nvif_mem_init(mmu, mmu->mem, NVIF_MEM_MAPPABLE | type, 0, - size, NULL, 0, mem); + int ret = nvif_mem_ctor(mmu, name, mmu->mem, NVIF_MEM_MAPPABLE | type, + 0, size, NULL, 0, mem); if (ret == 0) { ret = nvif_object_map(&mem->object, NULL, 0); if (ret) - nvif_mem_fini(mem); + nvif_mem_dtor(mem); } return ret; } void -nvif_mem_fini(struct nvif_mem *mem) +nvif_mem_dtor(struct nvif_mem *mem) { - nvif_object_fini(&mem->object); + nvif_object_dtor(&mem->object); } int -nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, - u64 size, void *argv, u32 argc, struct nvif_mem *mem) +nvif_mem_ctor_type(struct nvif_mmu *mmu, const char *name, s32 oclass, + int type, u8 page, u64 size, void *argv, u32 argc, + struct nvif_mem *mem) { struct nvif_mem_v0 *args; u8 stack[128]; @@ -67,8 +69,8 @@ nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, args->size = size; memcpy(args->data, argv, argc); - ret = nvif_object_init(&mmu->object, 0, oclass, args, - sizeof(*args) + argc, &mem->object); + ret = nvif_object_ctor(&mmu->object, name ? name : "nvifMem", 0, oclass, + args, sizeof(*args) + argc, &mem->object); if (ret == 0) { mem->type = mmu->type[type].type; mem->page = args->page; @@ -83,8 +85,8 @@ nvif_mem_init_type(struct nvif_mmu *mmu, s32 oclass, int type, u8 page, } int -nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page, - u64 size, void *argv, u32 argc, struct nvif_mem *mem) +nvif_mem_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass, u8 type, + u8 page, u64 size, void *argv, u32 argc, struct nvif_mem *mem) { int ret = -EINVAL, i; @@ -92,8 +94,8 @@ nvif_mem_init(struct nvif_mmu *mmu, s32 oclass, u8 type, u8 page, for (i = 0; ret && i < mmu->type_nr; i++) { if ((mmu->type[i].type & type) == type) { - ret = nvif_mem_init_type(mmu, oclass, i, page, size, - argv, argc, mem); + ret = nvif_mem_ctor_type(mmu, name, oclass, i, page, + size, argv, argc, mem); } } diff --git a/drivers/gpu/drm/nouveau/nvif/mmu.c b/drivers/gpu/drm/nouveau/nvif/mmu.c index 47efc408efa6..3709cbbc19a1 100644 --- a/drivers/gpu/drm/nouveau/nvif/mmu.c +++ b/drivers/gpu/drm/nouveau/nvif/mmu.c @@ -25,16 +25,17 @@ #include <nvif/if0008.h> void -nvif_mmu_fini(struct nvif_mmu *mmu) +nvif_mmu_dtor(struct nvif_mmu *mmu) { kfree(mmu->kind); kfree(mmu->type); kfree(mmu->heap); - nvif_object_fini(&mmu->object); + nvif_object_dtor(&mmu->object); } int -nvif_mmu_init(struct nvif_object *parent, s32 oclass, struct nvif_mmu *mmu) +nvif_mmu_ctor(struct nvif_object *parent, const char *name, s32 oclass, + struct nvif_mmu *mmu) { static const struct nvif_mclass mems[] = { { NVIF_CLASS_MEM_GF100, -1 }, @@ -50,8 +51,8 @@ nvif_mmu_init(struct nvif_object *parent, s32 oclass, struct nvif_mmu *mmu) mmu->type = NULL; mmu->kind = NULL; - ret = nvif_object_init(parent, 0, oclass, &args, sizeof(args), - &mmu->object); + ret = nvif_object_ctor(parent, name ? name : "nvifMmu", 0, oclass, + &args, sizeof(args), &mmu->object); if (ret) goto done; @@ -127,6 +128,6 @@ nvif_mmu_init(struct nvif_object *parent, s32 oclass, struct nvif_mmu *mmu) done: if (ret) - nvif_mmu_fini(mmu); + nvif_mmu_dtor(mmu); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvif/notify.c b/drivers/gpu/drm/nouveau/nvif/notify.c index 278b3933dc96..143c8dc6889e 100644 --- a/drivers/gpu/drm/nouveau/nvif/notify.c +++ b/drivers/gpu/drm/nouveau/nvif/notify.c @@ -142,7 +142,7 @@ nvif_notify(const void *header, u32 length, const void *data, u32 size) } int -nvif_notify_fini(struct nvif_notify *notify) +nvif_notify_dtor(struct nvif_notify *notify) { struct nvif_object *object = notify->object; struct { @@ -162,9 +162,9 @@ nvif_notify_fini(struct nvif_notify *notify) } int -nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), - bool work, u8 event, void *data, u32 size, u32 reply, - struct nvif_notify *notify) +nvif_notify_ctor(struct nvif_object *object, const char *name, + int (*func)(struct nvif_notify *), bool work, u8 event, + void *data, u32 size, u32 reply, struct nvif_notify *notify) { struct { struct nvif_ioctl_v0 ioctl; @@ -174,6 +174,7 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), int ret = -ENOMEM; notify->object = object; + notify->name = name ? name : "nvifNotify"; notify->flags = 0; atomic_set(¬ify->putcnt, 1); notify->func = func; @@ -204,6 +205,6 @@ nvif_notify_init(struct nvif_object *object, int (*func)(struct nvif_notify *), kfree(args); done: if (ret) - nvif_notify_fini(notify); + nvif_notify_dtor(notify); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c index ef3f62840e83..671a5c0199e0 100644 --- a/drivers/gpu/drm/nouveau/nvif/object.c +++ b/drivers/gpu/drm/nouveau/nvif/object.c @@ -242,7 +242,7 @@ nvif_object_map(struct nvif_object *object, void *argv, u32 argc) } void -nvif_object_fini(struct nvif_object *object) +nvif_object_dtor(struct nvif_object *object) { struct { struct nvif_ioctl_v0 ioctl; @@ -260,8 +260,8 @@ nvif_object_fini(struct nvif_object *object) } int -nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, - void *data, u32 size, struct nvif_object *object) +nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle, + s32 oclass, void *data, u32 size, struct nvif_object *object) { struct { struct nvif_ioctl_v0 ioctl; @@ -270,6 +270,7 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, int ret = 0; object->client = NULL; + object->name = name ? name : "nvifObject"; object->handle = handle; object->oclass = oclass; object->map.ptr = NULL; @@ -277,10 +278,12 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, if (parent) { if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) { - nvif_object_fini(object); + nvif_object_dtor(object); return -ENOMEM; } + object->parent = parent->parent; + args->ioctl.version = 0; args->ioctl.type = NVIF_IOCTL_V0_NEW; args->new.version = 0; @@ -300,6 +303,6 @@ nvif_object_init(struct nvif_object *parent, u32 handle, s32 oclass, } if (ret) - nvif_object_fini(object); + nvif_object_dtor(object); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvif/user.c b/drivers/gpu/drm/nouveau/nvif/user.c index 10da3cdca647..d89f5b67b304 100644 --- a/drivers/gpu/drm/nouveau/nvif/user.c +++ b/drivers/gpu/drm/nouveau/nvif/user.c @@ -25,16 +25,16 @@ #include <nvif/class.h> void -nvif_user_fini(struct nvif_device *device) +nvif_user_dtor(struct nvif_device *device) { if (device->user.func) { - nvif_object_fini(&device->user.object); + nvif_object_dtor(&device->user.object); device->user.func = NULL; } } int -nvif_user_init(struct nvif_device *device) +nvif_user_ctor(struct nvif_device *device, const char *name) { struct { s32 oclass; @@ -53,7 +53,8 @@ nvif_user_init(struct nvif_device *device) if (cid < 0) return cid; - ret = nvif_object_init(&device->object, 0, users[cid].oclass, NULL, 0, + ret = nvif_object_ctor(&device->object, name ? name : "nvifUsermode", + 0, users[cid].oclass, NULL, 0, &device->user.object); if (ret) return ret; diff --git a/drivers/gpu/drm/nouveau/nvif/vmm.c b/drivers/gpu/drm/nouveau/nvif/vmm.c index 11487c00b909..6053d6dc2184 100644 --- a/drivers/gpu/drm/nouveau/nvif/vmm.c +++ b/drivers/gpu/drm/nouveau/nvif/vmm.c @@ -105,15 +105,15 @@ nvif_vmm_get(struct nvif_vmm *vmm, enum nvif_vmm_get type, bool sparse, } void -nvif_vmm_fini(struct nvif_vmm *vmm) +nvif_vmm_dtor(struct nvif_vmm *vmm) { kfree(vmm->page); - nvif_object_fini(&vmm->object); + nvif_object_dtor(&vmm->object); } int -nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, bool managed, u64 addr, - u64 size, void *argv, u32 argc, struct nvif_vmm *vmm) +nvif_vmm_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass, bool managed, + u64 addr, u64 size, void *argv, u32 argc, struct nvif_vmm *vmm) { struct nvif_vmm_v0 *args; u32 argn = sizeof(*args) + argc; @@ -130,8 +130,8 @@ nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, bool managed, u64 addr, args->size = size; memcpy(args->data, argv, argc); - ret = nvif_object_init(&mmu->object, 0, oclass, args, argn, - &vmm->object); + ret = nvif_object_ctor(&mmu->object, name ? name : "nvifVmm", 0, + oclass, args, argn, &vmm->object); if (ret) goto done; @@ -163,7 +163,7 @@ nvif_vmm_init(struct nvif_mmu *mmu, s32 oclass, bool managed, u64 addr, done: if (ret) - nvif_vmm_fini(vmm); + nvif_vmm_dtor(vmm); kfree(args); return ret; } |