From bf81df9be28657eea4aca8c6ab4ed3e69f8a051c Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 20 Aug 2015 14:54:16 +1000 Subject: drm/nouveau/nvif: replace path-based object identification Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/nvif/client.c | 2 -- drivers/gpu/drm/nouveau/nvif/object.c | 17 +++++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/drm/nouveau/nvif') diff --git a/drivers/gpu/drm/nouveau/nvif/client.c b/drivers/gpu/drm/nouveau/nvif/client.c index 4a830ebf9661..64d3d0c37a83 100644 --- a/drivers/gpu/drm/nouveau/nvif/client.c +++ b/drivers/gpu/drm/nouveau/nvif/client.c @@ -50,7 +50,6 @@ nvif_client_fini(struct nvif_client *client) if (client->driver) { client->driver->fini(client->object.priv); client->driver = NULL; - client->object.parent = NULL; client->object.client = NULL; nvif_object_fini(&client->object); } @@ -79,7 +78,6 @@ nvif_client_init(const char *driver, const char *name, u64 device, return ret; client->object.client = client; - client->object.parent = &client->object; client->object.handle = ~0; client->route = NVIF_IOCTL_V0_ROUTE_NVIF; client->super = true; diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c index a727f72ca234..b914e34a43c3 100644 --- a/drivers/gpu/drm/nouveau/nvif/object.c +++ b/drivers/gpu/drm/nouveau/nvif/object.c @@ -36,14 +36,11 @@ nvif_object_ioctl(struct nvif_object *object, void *data, u32 size, void **hack) } *args = data; if (size >= sizeof(*args) && args->v0.version == 0) { + if (object != &client->object) + args->v0.object = nvif_handle(object); + else + args->v0.object = 0; args->v0.owner = NVIF_IOCTL_V0_OWNER_ANY; - args->v0.path_nr = 0; - while (args->v0.path_nr < ARRAY_SIZE(args->v0.path)) { - args->v0.path[args->v0.path_nr++] = object->handle; - if (object->parent == object) - break; - object = object->parent; - } } else return -ENOSYS; @@ -216,13 +213,12 @@ nvif_object_init(struct nvif_object *parent, u32 handle, u32 oclass, int ret = 0; object->client = NULL; - object->parent = parent; object->handle = handle; object->oclass = oclass; object->map.ptr = NULL; object->map.size = 0; - if (object->parent) { + if (parent) { if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) { nvif_object_fini(object); return -ENOMEM; @@ -232,7 +228,8 @@ nvif_object_init(struct nvif_object *parent, u32 handle, u32 oclass, args->ioctl.type = NVIF_IOCTL_V0_NEW; args->new.version = 0; args->new.route = parent->client->route; - args->new.token = (unsigned long)(void *)object; + args->new.token = nvif_handle(object); + args->new.object = nvif_handle(object); args->new.handle = handle; args->new.oclass = oclass; -- cgit v1.2.3-59-g8ed1b