diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-11-24 14:36:48 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-12-22 13:22:07 +1000 |
commit | 0996ad0e12a25841f350b8c5cacccff3d0aa24d2 (patch) | |
tree | 95942c8724139344778a38c8a30415789c0423a0 /nouveau | |
parent | 4a3cbf5c0a38adf41d637c5d7273480336df39d0 (diff) |
nouveau: move object functions up, to avoid future foward decls
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'nouveau')
-rw-r--r-- | nouveau/nouveau.c | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c index 8a0be2fa..8035c6a0 100644 --- a/nouveau/nouveau.c +++ b/nouveau/nouveau.c @@ -59,6 +59,62 @@ debug_init(char *args) } #endif +int +nouveau_object_new(struct nouveau_object *parent, uint64_t handle, + uint32_t oclass, void *data, uint32_t length, + struct nouveau_object **pobj) +{ + struct nouveau_object *obj; + int (*func)(struct nouveau_object *); + int ret = -EINVAL; + + if (length == 0) + length = sizeof(struct nouveau_object *); + obj = malloc(sizeof(*obj) + length); + obj->parent = parent; + obj->handle = handle; + obj->oclass = oclass; + obj->length = length; + obj->data = obj + 1; + if (data) + memcpy(obj->data, data, length); + *(struct nouveau_object **)obj->data = obj; + + abi16_object(obj, &func); + if (func) + ret = func(obj); + + if (ret) { + free(obj); + return ret; + } + + *pobj = obj; + return 0; +} + +void +nouveau_object_del(struct nouveau_object **pobj) +{ + struct nouveau_object *obj = *pobj; + if (obj) { + abi16_delete(obj); + free(obj); + *pobj = NULL; + } +} + +void * +nouveau_object_find(struct nouveau_object *obj, uint32_t pclass) +{ + while (obj && obj->oclass != pclass) { + obj = obj->parent; + if (pclass == NOUVEAU_PARENT_CLASS) + break; + } + return obj; +} + /* this is the old libdrm's version of nouveau_device_wrap(), the symbol * is kept here to prevent AIGLX from crashing if the DDX is linked against * the new libdrm, but the DRI driver against the old @@ -247,62 +303,6 @@ nouveau_client_del(struct nouveau_client **pclient) } } -int -nouveau_object_new(struct nouveau_object *parent, uint64_t handle, - uint32_t oclass, void *data, uint32_t length, - struct nouveau_object **pobj) -{ - struct nouveau_object *obj; - int (*func)(struct nouveau_object *); - int ret = -EINVAL; - - if (length == 0) - length = sizeof(struct nouveau_object *); - obj = malloc(sizeof(*obj) + length); - obj->parent = parent; - obj->handle = handle; - obj->oclass = oclass; - obj->length = length; - obj->data = obj + 1; - if (data) - memcpy(obj->data, data, length); - *(struct nouveau_object **)obj->data = obj; - - abi16_object(obj, &func); - if (func) - ret = func(obj); - - if (ret) { - free(obj); - return ret; - } - - *pobj = obj; - return 0; -} - -void -nouveau_object_del(struct nouveau_object **pobj) -{ - struct nouveau_object *obj = *pobj; - if (obj) { - abi16_delete(obj); - free(obj); - *pobj = NULL; - } -} - -void * -nouveau_object_find(struct nouveau_object *obj, uint32_t pclass) -{ - while (obj && obj->oclass != pclass) { - obj = obj->parent; - if (pclass == NOUVEAU_PARENT_CLASS) - break; - } - return obj; -} - static void nouveau_bo_del(struct nouveau_bo *bo) { |