summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/core/engine.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-08-20 14:54:17 +1000
committerBen Skeggs <bskeggs@redhat.com>2015-08-28 12:40:35 +1000
commit6cf813fb26640ef539051fb7f965af8c9ff10d92 (patch)
treecbb7d8fa7199ad86a1b4b26458c17cb54136736c /drivers/gpu/drm/nouveau/nvkm/core/engine.c
parent7974dd1bdb43aaf5b45a915c6b439d11733450fc (diff)
drm/nouveau/device: prepare for new-style subdevs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/core/engine.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/engine.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/engine.c b/drivers/gpu/drm/nouveau/nvkm/core/engine.c
index 07559e7c4c4c..eabd271f68b3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/engine.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/engine.c
@@ -68,6 +68,8 @@ static int
nvkm_engine_fini(struct nvkm_subdev *obj, bool suspend)
{
struct nvkm_engine *engine = container_of(obj, typeof(*engine), subdev);
+ if (engine->subdev.object.oclass)
+ return engine->subdev.object.oclass->ofuncs->fini(&engine->subdev.object, suspend);
if (engine->func->fini)
return engine->func->fini(engine, suspend);
return 0;
@@ -86,6 +88,9 @@ nvkm_engine_init(struct nvkm_subdev *obj)
return ret;
}
+ if (engine->subdev.object.oclass)
+ return engine->subdev.object.oclass->ofuncs->init(&engine->subdev.object);
+
if (engine->func->oneinit && !engine->subdev.oneinit) {
nvkm_trace(subdev, "one-time init running...\n");
time = ktime_to_us(ktime_get());
@@ -110,6 +115,10 @@ static void *
nvkm_engine_dtor(struct nvkm_subdev *obj)
{
struct nvkm_engine *engine = container_of(obj, typeof(*engine), subdev);
+ if (engine->subdev.object.oclass) {
+ engine->subdev.object.oclass->ofuncs->dtor(&engine->subdev.object);
+ return NULL;
+ }
if (engine->func->dtor)
return engine->func->dtor(engine);
return engine;
@@ -201,5 +210,6 @@ nvkm_engine_create_(struct nvkm_object *parent, struct nvkm_object *engobj,
INIT_LIST_HEAD(&engine->contexts);
spin_lock_init(&engine->lock);
+ engine->subdev.func = &nvkm_engine_func;
return 0;
}