[Nouveau] [libdrm v2 03/14] nouveau: move object functions up, to avoid future foward decls

Ben Skeggs skeggsb at gmail.com
Thu Nov 26 17:02:42 PST 2015


From: Ben Skeggs <bskeggs at redhat.com>

Signed-off-by: Ben Skeggs <bskeggs at redhat.com>
---
 nouveau/nouveau.c | 112 +++++++++++++++++++++++++++---------------------------
 1 file changed, 56 insertions(+), 56 deletions(-)

diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 8a0be2f..8035c6a 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)
 {
-- 
2.6.3



More information about the Nouveau mailing list