From ef8bc5760b51d69741ed5f42224f1fdd2935541a Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 20 Aug 2015 14:54:19 +1000 Subject: [PATCH] drm/nouveau/core: kill some (now) dead code Signed-off-by: Ben Skeggs --- .../drm/nouveau/include/nvkm/core/engctx.h | 48 ----- .../drm/nouveau/include/nvkm/core/parent.h | 51 ------ drivers/gpu/drm/nouveau/nvkm/core/Kbuild | 2 - drivers/gpu/drm/nouveau/nvkm/core/engctx.c | 166 ------------------ drivers/gpu/drm/nouveau/nvkm/core/handle.c | 22 +-- drivers/gpu/drm/nouveau/nvkm/core/ioctl.c | 120 ------------- drivers/gpu/drm/nouveau/nvkm/core/parent.c | 139 --------------- .../gpu/drm/nouveau/nvkm/engine/device/base.c | 1 - .../gpu/drm/nouveau/nvkm/engine/device/user.c | 46 ----- .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c | 81 --------- 10 files changed, 1 insertion(+), 675 deletions(-) delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/engctx.h delete mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/parent.h delete mode 100644 drivers/gpu/drm/nouveau/nvkm/core/engctx.c delete mode 100644 drivers/gpu/drm/nouveau/nvkm/core/parent.c diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/engctx.h b/drivers/gpu/drm/nouveau/include/nvkm/core/engctx.h deleted file mode 100644 index 4a77fdaa8b90..000000000000 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/engctx.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __NVKM_ENGCTX_H__ -#define __NVKM_ENGCTX_H__ -#include -#include - -#include - -#define NV_ENGCTX_(eng,var) (((var) << 8) | (eng)) -#define NV_ENGCTX(name,var) NV_ENGCTX_(NVDEV_ENGINE_##name, (var)) - -struct nvkm_engctx { - struct nvkm_gpuobj gpuobj; - struct nvkm_vma vma; - struct list_head head; - unsigned long save; - u64 addr; -}; - -static inline struct nvkm_engctx * -nv_engctx(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - BUG_ON(!nv_iclass(obj, NV_ENGCTX_CLASS)); -#endif - return obj; -} - -#define nvkm_engctx_create(p,e,c,g,s,a,f,d) \ - nvkm_engctx_create_((p), (e), (c), (g), (s), (a), (f), \ - sizeof(**d), (void **)d) - -int nvkm_engctx_create_(struct nvkm_object *, struct nvkm_object *, - struct nvkm_oclass *, struct nvkm_object *, - u32 size, u32 align, u32 flags, - int length, void **data); -void nvkm_engctx_destroy(struct nvkm_engctx *); -int nvkm_engctx_init(struct nvkm_engctx *); -int nvkm_engctx_fini(struct nvkm_engctx *, bool suspend); - -int _nvkm_engctx_ctor(struct nvkm_object *, struct nvkm_object *, - struct nvkm_oclass *, void *, u32, - struct nvkm_object **); -void _nvkm_engctx_dtor(struct nvkm_object *); -int _nvkm_engctx_init(struct nvkm_object *); -int _nvkm_engctx_fini(struct nvkm_object *, bool suspend); -#define _nvkm_engctx_rd32 _nvkm_gpuobj_rd32 -#define _nvkm_engctx_wr32 _nvkm_gpuobj_wr32 -#endif diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/parent.h b/drivers/gpu/drm/nouveau/include/nvkm/core/parent.h deleted file mode 100644 index 92270afc666a..000000000000 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/parent.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __NVKM_PARENT_H__ -#define __NVKM_PARENT_H__ -#include - -struct nvkm_parent { - struct nvkm_object object; - - struct nvkm_oclass *sclass; - u64 engine; - - int (*context_attach)(struct nvkm_object *, struct nvkm_object *); - int (*context_detach)(struct nvkm_object *, bool suspend, - struct nvkm_object *); - - int (*object_attach)(struct nvkm_object *parent, - struct nvkm_object *object, u32 name); - void (*object_detach)(struct nvkm_object *parent, int cookie); -}; - -static inline struct nvkm_parent * -nv_parent(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - BUG_ON(!(nv_iclass(obj, NV_PARENT_CLASS))); -#endif - return obj; -} - -#define nvkm_parent_create(p,e,c,v,s,m,d) \ - nvkm_parent_create_((p), (e), (c), (v), (s), (m), \ - sizeof(**d), (void **)d) -#define nvkm_parent_init(p) \ - _nvkm_object_init(&(p)->object) -#define nvkm_parent_fini(p,s) \ - _nvkm_object_fini(&(p)->object, (s)) - -int nvkm_parent_create_(struct nvkm_object *, struct nvkm_object *, - struct nvkm_oclass *, u32 pclass, - struct nvkm_oclass *, u64 engcls, - int size, void **); -void nvkm_parent_destroy(struct nvkm_parent *); - -void _nvkm_parent_dtor(struct nvkm_object *); -#define _nvkm_parent_init _nvkm_object_init -#define _nvkm_parent_fini _nvkm_object_fini - -int nvkm_parent_sclass(struct nvkm_object *, s32 handle, - struct nvkm_object **pengine, - struct nvkm_oclass **poclass); -int nvkm_parent_lclass(struct nvkm_object *, void *, int); -#endif diff --git a/drivers/gpu/drm/nouveau/nvkm/core/Kbuild b/drivers/gpu/drm/nouveau/nvkm/core/Kbuild index d3932d59ff09..09044cf0d9ff 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/core/Kbuild @@ -1,5 +1,4 @@ nvkm-y := nvkm/core/client.o -nvkm-y += nvkm/core/engctx.o nvkm-y += nvkm/core/engine.o nvkm-y += nvkm/core/enum.o nvkm-y += nvkm/core/event.o @@ -12,6 +11,5 @@ nvkm-y += nvkm/core/notify.o nvkm-y += nvkm/core/object.o nvkm-y += nvkm/core/oproxy.o nvkm-y += nvkm/core/option.o -nvkm-y += nvkm/core/parent.o nvkm-y += nvkm/core/ramht.o nvkm-y += nvkm/core/subdev.o diff --git a/drivers/gpu/drm/nouveau/nvkm/core/engctx.c b/drivers/gpu/drm/nouveau/nvkm/core/engctx.c deleted file mode 100644 index bd13facc53d8..000000000000 --- a/drivers/gpu/drm/nouveau/nvkm/core/engctx.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Ben Skeggs - */ -#include -#include -#include - -static inline int -nvkm_engctx_exists(struct nvkm_object *parent, - struct nvkm_engine *engine, void **pobject) -{ - struct nvkm_engctx *engctx; - struct nvkm_object *parctx; - - list_for_each_entry(engctx, &engine->contexts, head) { - parctx = nv_pclass(nv_object(engctx), NV_PARENT_CLASS); - if (parctx == parent) { - atomic_inc(&nv_object(engctx)->refcount); - *pobject = engctx; - return 1; - } - } - - return 0; -} - -int -nvkm_engctx_create_(struct nvkm_object *parent, struct nvkm_object *engobj, - struct nvkm_oclass *oclass, struct nvkm_object *pargpu, - u32 size, u32 align, u32 flags, int length, void **pobject) -{ - struct nvkm_client *client = nvkm_client(parent); - struct nvkm_engine *engine = nv_engine(engobj); - struct nvkm_object *engctx; - unsigned long save; - int ret; - - /* check if this engine already has a context for the parent object, - * and reference it instead of creating a new one - */ - spin_lock_irqsave(&engine->lock, save); - ret = nvkm_engctx_exists(parent, engine, pobject); - spin_unlock_irqrestore(&engine->lock, save); - if (ret) - return ret; - - /* create the new context, supports creating both raw objects and - * objects backed by instance memory - */ - if (size) { - ret = nvkm_gpuobj_create_(parent, engobj, oclass, - NV_ENGCTX_CLASS, pargpu, size, - align, flags, length, pobject); - } else { - ret = nvkm_object_create_(parent, engobj, oclass, - NV_ENGCTX_CLASS, length, pobject); - } - - engctx = *pobject; - if (ret) - return ret; - - /* must take the lock again and re-check a context doesn't already - * exist (in case of a race) - the lock had to be dropped before as - * it's not possible to allocate the object with it held. - */ - spin_lock_irqsave(&engine->lock, save); - ret = nvkm_engctx_exists(parent, engine, pobject); - if (ret) { - spin_unlock_irqrestore(&engine->lock, save); - nvkm_object_ref(NULL, &engctx); - return ret; - } - - if (client->vm) - atomic_inc(&client->vm->engref[nv_engidx(engine)]); - list_add(&nv_engctx(engctx)->head, &engine->contexts); - nv_engctx(engctx)->addr = ~0ULL; - spin_unlock_irqrestore(&engine->lock, save); - return 0; -} - -void -nvkm_engctx_destroy(struct nvkm_engctx *engctx) -{ - struct nvkm_engine *engine = engctx->gpuobj.object.engine; - struct nvkm_client *client = nvkm_client(&engctx->gpuobj.object); - unsigned long save; - - nvkm_gpuobj_unmap(&engctx->vma); - spin_lock_irqsave(&engine->lock, save); - list_del(&engctx->head); - spin_unlock_irqrestore(&engine->lock, save); - - if (client->vm) - atomic_dec(&client->vm->engref[nv_engidx(engine)]); - - if (engctx->gpuobj.size) - nvkm_gpuobj_destroy(&engctx->gpuobj); - else - nvkm_object_destroy(&engctx->gpuobj.object); -} - -int -nvkm_engctx_init(struct nvkm_engctx *engctx) -{ - return nvkm_gpuobj_init(&engctx->gpuobj); -} - -int -nvkm_engctx_fini(struct nvkm_engctx *engctx, bool suspend) -{ - return nvkm_gpuobj_fini(&engctx->gpuobj, suspend); -} - -int -_nvkm_engctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) -{ - struct nvkm_engctx *engctx; - int ret; - - ret = nvkm_engctx_create(parent, engine, oclass, NULL, 256, 256, - NVOBJ_FLAG_ZERO_ALLOC, &engctx); - *pobject = nv_object(engctx); - return ret; -} - -void -_nvkm_engctx_dtor(struct nvkm_object *object) -{ - nvkm_engctx_destroy(nv_engctx(object)); -} - -int -_nvkm_engctx_init(struct nvkm_object *object) -{ - return nvkm_engctx_init(nv_engctx(object)); -} - -int -_nvkm_engctx_fini(struct nvkm_object *object, bool suspend) -{ - return nvkm_engctx_fini(nv_engctx(object), suspend); -} diff --git a/drivers/gpu/drm/nouveau/nvkm/core/handle.c b/drivers/gpu/drm/nouveau/nvkm/core/handle.c index a74ee1c29f8c..d185cae0fbba 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/handle.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/handle.c @@ -23,7 +23,6 @@ */ #include #include -#include #define hprintk(h,l,f,a...) do { \ struct nvkm_handle *p = (h)->parent; u32 n = p ? p->name : ~0; \ @@ -99,7 +98,6 @@ nvkm_handle_create(struct nvkm_handle *parent, u32 _handle, struct nvkm_object *object, struct nvkm_handle **phandle) { struct nvkm_handle *handle; - int ret; handle = kzalloc(sizeof(*handle), GFP_KERNEL); if (!handle) @@ -113,21 +111,8 @@ nvkm_handle_create(struct nvkm_handle *parent, u32 _handle, handle->parent = parent; nvkm_object_ref(object, &handle->object); - if (parent) { - if (nv_iclass(parent->object, NV_PARENT_CLASS) && - nv_parent(parent->object)->object_attach) { - ret = nv_parent(parent->object)-> - object_attach(parent->object, object, _handle); - if (ret < 0) { - nvkm_handle_destroy(handle); - return ret; - } - - handle->priv = ret; - } - + if (parent) list_add(&handle->head, &handle->parent->tree); - } hprintk(handle, TRACE, "created\n"); *phandle = handle; @@ -148,11 +133,6 @@ nvkm_handle_destroy(struct nvkm_handle *handle) nvkm_client_remove(client, handle); list_del(&handle->head); - if (handle->priv != ~0) { - struct nvkm_object *parent = handle->parent->object; - nv_parent(parent)->object_detach(parent, handle->priv); - } - hprintk(handle, TRACE, "destroy completed\n"); nvkm_object_ref(NULL, &handle->object); kfree(handle); diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c index 28f9fa289e80..d9bb0394d83f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -65,17 +64,6 @@ nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size) if (size != args->v0.count * sizeof(args->v0.oclass[0])) return -EINVAL; - if (object->oclass) { - if (nv_iclass(object, NV_PARENT_CLASS)) { - ret = nvkm_parent_lclass(object, - args->v0.oclass, - args->v0.count); - } - - args->v0.count = ret; - return 0; - } - while (object->func->sclass && object->func->sclass(object, i, &oclass) >= 0) { if (i < args->v0.count) { @@ -92,111 +80,6 @@ nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size) return ret; } -static int -nvkm_ioctl_new_old(struct nvkm_handle *handle, void *data, u32 size) -{ - union { - struct nvif_ioctl_new_v0 v0; - } *args = data; - struct nvkm_client *client = nvkm_client(handle->object); - struct nvkm_object *engctx = NULL; - struct nvkm_object *object = NULL; - struct nvkm_parent *parent; - struct nvkm_engine *engine; - struct nvkm_oclass *oclass; - u32 _handle, _oclass; - int ret; - - nvif_ioctl(handle->object, "new size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { - _handle = args->v0.handle; - _oclass = args->v0.oclass; - } else - return ret; - - nvif_ioctl(handle->object, "new vers %d handle %08x class %08x " - "route %02x token %llx object %016llx\n", - args->v0.version, _handle, _oclass, - args->v0.route, args->v0.token, args->v0.object); - - if (!nv_iclass(handle->object, NV_PARENT_CLASS)) { - nvif_debug(handle->object, "cannot have children (ctor)\n"); - ret = -ENODEV; - goto fail_class; - } - - parent = nv_parent(handle->object); - - /* check that parent supports the requested subclass */ - ret = nvkm_parent_sclass(&parent->object, _oclass, - (struct nvkm_object **)&engine, &oclass); - if (ret) { - nvif_debug(&parent->object, "illegal class 0x%04x\n", _oclass); - goto fail_class; - } - - /* make sure engine init has been completed *before* any objects - * it controls are created - the constructors may depend on - * state calculated at init (ie. default context construction) - */ - if (engine) { - engine = nvkm_engine_ref(engine); - if (IS_ERR(engine)) { - ret = PTR_ERR(engine); - engine = NULL; - goto fail_class; - } - } - - /* if engine requires it, create a context object to insert - * between the parent and its children (eg. PGRAPH context) - */ - if (engine && engine->cclass) { - ret = nvkm_object_old(&parent->object, &engine->subdev.object, - engine->cclass, data, size, &engctx); - if (ret) - goto fail_engctx; - } else { - nvkm_object_ref(&parent->object, &engctx); - } - - /* finally, create new object and bind it to its handle */ - ret = nvkm_object_old(engctx, &engine->subdev.object, oclass, - data, size, &object); - if (ret) - goto fail_ctor; - - object->handle = _handle; - - ret = nvkm_object_inc(object); - if (ret) - goto fail_init; - - ret = nvkm_handle_create(handle, _handle, object, &handle); - if (ret) - goto fail_handle; - - ret = nvkm_handle_init(handle); - handle->route = args->v0.route; - handle->token = args->v0.token; - if (ret) - nvkm_handle_destroy(handle); - - handle->handle = args->v0.object; - nvkm_client_insert(client, handle); - client->data = object; -fail_handle: - nvkm_object_dec(object, false); -fail_init: - nvkm_object_ref(NULL, &object); -fail_ctor: - nvkm_object_ref(NULL, &engctx); -fail_engctx: - nvkm_engine_unref(&engine); -fail_class: - return ret; -} - static int nvkm_ioctl_new(struct nvkm_handle *handle, void *data, u32 size) { @@ -209,9 +92,6 @@ nvkm_ioctl_new(struct nvkm_handle *handle, void *data, u32 size) struct nvkm_oclass oclass; int ret, i = 0; - if (parent->oclass) - return nvkm_ioctl_new_old(handle, data, size); - nvif_ioctl(parent, "new size %d\n", size); if (nvif_unpack(args->v0, 0, 0, true)) { nvif_ioctl(parent, "new vers %d handle %08x class %08x " diff --git a/drivers/gpu/drm/nouveau/nvkm/core/parent.c b/drivers/gpu/drm/nouveau/nvkm/core/parent.c deleted file mode 100644 index aecf5b8901b2..000000000000 --- a/drivers/gpu/drm/nouveau/nvkm/core/parent.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Ben Skeggs - */ -#include -#include -#include - -#include - -int -nvkm_parent_sclass(struct nvkm_object *parent, s32 handle, - struct nvkm_object **pengine, - struct nvkm_oclass **poclass) -{ - struct nvkm_oclass *sclass, *oclass; - struct nvkm_engine *engine; - u64 mask; - int i; - - sclass = nv_parent(parent)->sclass; - while ((oclass = sclass++) && oclass->ofuncs) { - if (oclass->handle == handle) { - *pengine = &parent->engine->subdev.object; - *poclass = oclass; - return 0; - } - } - - mask = nv_parent(parent)->engine; - while (i = __ffs64(mask), mask) { - engine = nvkm_engine(parent, i); - if (engine) { - oclass = engine->sclass; - while (oclass->ofuncs) { - if (oclass->handle == handle) { - *pengine = nv_object(engine); - *poclass = oclass; - return 0; - } - oclass++; - } - } - - mask &= ~(1ULL << i); - } - - return -EINVAL; -} - -int -nvkm_parent_lclass(struct nvkm_object *parent, void *data, int size) -{ - struct nvif_ioctl_sclass_oclass_v0 *lclass = data; - struct nvkm_oclass *sclass, *oclass; - struct nvkm_engine *engine; - int nr = -1, i; - u64 mask; - - sclass = nv_parent(parent)->sclass; - while ((oclass = sclass++) && oclass->ofuncs) { - if (++nr < size) { - lclass[nr].oclass = oclass->handle; - lclass[nr].minver = -2; - lclass[nr].maxver = -2; - } - } - - mask = nv_parent(parent)->engine; - while (i = __ffs64(mask), mask) { - engine = nvkm_engine(parent, i); - if (engine && (oclass = engine->sclass)) { - while (oclass->ofuncs) { - if (++nr < size) { - lclass[nr].oclass = oclass->handle; - lclass[nr].minver = -2; - lclass[nr].maxver = -2; - } - oclass++; - } - } - - mask &= ~(1ULL << i); - } - - return nr + 1; -} - -int -nvkm_parent_create_(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, u32 pclass, - struct nvkm_oclass *sclass, u64 engcls, - int size, void **pobject) -{ - struct nvkm_parent *object; - int ret; - - ret = nvkm_object_create_(parent, engine, oclass, pclass | - NV_PARENT_CLASS, size, pobject); - object = *pobject; - if (ret) - return ret; - - object->sclass = sclass; - object->engine = engcls; - return 0; -} - -void -nvkm_parent_destroy(struct nvkm_parent *parent) -{ - nvkm_object_destroy(&parent->object); -} - - -void -_nvkm_parent_dtor(struct nvkm_object *object) -{ - nvkm_parent_destroy(nv_parent(object)); -} diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c index 73770fb4da97..46d616c7259d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c @@ -1977,7 +1977,6 @@ nv12b_chipset = { // .sw = gf100_sw_new, }; -#include #include struct nvkm_device * diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c index 39f31e2e281b..c5da091c058c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c @@ -26,7 +26,6 @@ #include "ctrl.h" #include -#include #include #include #include @@ -247,31 +246,6 @@ done: return ret; } -static int -nvkm_udevice_child_old(const struct nvkm_oclass *oclass, - void *data, u32 size, struct nvkm_object **pobject) -{ - struct nvkm_object *parent = oclass->parent; - struct nvkm_engine *engine = oclass->engine; - struct nvkm_oclass *eclass = (void *)oclass->priv; - struct nvkm_object *engctx = NULL; - int ret; - - if (engine->cclass) { - ret = nvkm_object_old(parent, &engine->subdev.object, - engine->cclass, NULL, 0, &engctx); - if (ret) - return ret; - } else { - nvkm_object_ref(parent, &engctx); - } - - ret = nvkm_object_old(engctx, &engine->subdev.object, eclass, - data, size, pobject); - nvkm_object_ref(NULL, &engctx); - return ret; -} - static int nvkm_udevice_child_new(const struct nvkm_oclass *oclass, void *data, u32 size, struct nvkm_object **pobject) @@ -296,26 +270,6 @@ nvkm_udevice_child_get(struct nvkm_object *object, int index, int i; for (; i = __ffs64(mask), mask && !sclass; mask &= ~(1ULL << i)) { - if ((engine = nvkm_device_engine(device, i)) && - !engine->func) { - struct nvkm_oclass *sclass = engine->sclass; - int c = 0; - while (sclass && sclass->ofuncs) { - if (c++ == index) { - oclass->base.oclass = sclass->handle; - oclass->base.minver = -2; - oclass->base.maxver = -2; - oclass->ctor = nvkm_udevice_child_old; - oclass->priv = sclass; - oclass->engine = engine; - return 0; - } - sclass++; - } - index -= c; - continue; - } - if (!(engine = nvkm_device_engine(device, i)) || !(engine->func->base.sclass)) continue; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c index 2735c2df2218..a02c60f340c0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c @@ -128,67 +128,6 @@ nvkm_fifo_chan_child_func = { .fini[0] = nvkm_fifo_chan_child_fini, }; -static int -nvkm_fifo_chan_child_old(const struct nvkm_oclass *oclass, - void *data, u32 size, struct nvkm_object **pobject) -{ - struct nvkm_fifo_chan *chan = nvkm_fifo_chan(oclass->parent); - struct nvkm_object *parent = &chan->object; - struct nvkm_engine *engine = oclass->engine; - struct nvkm_oclass *eclass = (void *)oclass->priv; - struct nvkm_object *engctx = NULL; - struct nvkm_fifo_chan_object *object; - struct nvkm_fifo_engn *engn = &chan->engn[engine->subdev.index]; - int ret; - - if (!(object = kzalloc(sizeof(*object), GFP_KERNEL))) - return -ENOMEM; - nvkm_oproxy_ctor(&nvkm_fifo_chan_child_func, oclass, &object->oproxy); - *pobject = &object->oproxy.base; - object->chan = chan; - - if (!engn->refcount++) { - if (chan->vm) - atomic_inc(&chan->vm->engref[engine->subdev.index]); - if (engine->cclass && !engn->object) { - ret = nvkm_object_old(parent, &engine->subdev.object, - engine->cclass, NULL, 0, - &engn->object); - if (ret) { - nvkm_engine_unref(&engine); - return ret; - } - } else { - nvkm_object_ref(parent, &engn->object); - } - - if (chan->func->engine_ctor) { - ret = chan->func->engine_ctor(chan, engine, - engn->object); - if (ret) - return ret; - } - } - nvkm_object_ref(engn->object, &engctx); - - ret = nvkm_object_old(engctx, &engine->subdev.object, eclass, - data, size, &object->oproxy.object); - nvkm_object_ref(NULL, &engctx); - if (ret) - return ret; - - object->oproxy.object->handle = oclass->handle; - - if (chan->func->object_ctor) { - object->hash = - chan->func->object_ctor(chan, object->oproxy.object); - if (object->hash < 0) - return object->hash; - } - - return 0; -} - static int nvkm_fifo_chan_child_new(const struct nvkm_oclass *oclass, void *data, u32 size, struct nvkm_object **pobject) @@ -269,26 +208,6 @@ nvkm_fifo_chan_child_get(struct nvkm_object *object, int index, int ret, i, c; for (; c = 0, i = __ffs64(mask), mask; mask &= ~(1ULL << i)) { - if ((engine = nvkm_device_engine(device, i)) && - !engine->func) { - struct nvkm_oclass *sclass = engine->sclass; - int c = 0; - while (sclass && sclass->ofuncs) { - if (c++ == index) { - oclass->base.oclass = sclass->handle; - oclass->base.minver = -2; - oclass->base.maxver = -2; - oclass->ctor = nvkm_fifo_chan_child_old; - oclass->priv = sclass; - oclass->engine = engine; - return 0; - } - sclass++; - } - index -= c; - continue; - } - if (!(engine = nvkm_device_engine(device, i))) continue; oclass->engine = engine; -- 2.39.2