[PATCH RFC 034/111] staging: etnaviv: convert cmdbuf release to use etnaviv_gem_ops

Lucas Stach l.stach at pengutronix.de
Thu Apr 2 08:29:36 PDT 2015


From: Russell King <rmk+kernel at arm.linux.org.uk>

Convert the command buffer release handling to use the etnaviv_gem_ops
release method.

Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_gem.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c
index 38e6b8ab3124..58a56b9e7abc 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.c
+++ b/drivers/staging/etnaviv/etnaviv_gem.c
@@ -514,12 +514,21 @@ static void etnaviv_free_cmd(struct drm_gem_object *obj)
 
 	drm_gem_free_mmap_offset(obj);
 
-	dma_free_coherent(obj->dev->dev, obj->size,
+	etnaviv_obj->ops->release(etnaviv_obj);
+}
+
+static void etnaviv_gem_cmd_release(struct etnaviv_gem_object *etnaviv_obj)
+{
+	dma_free_coherent(etnaviv_obj->base.dev->dev, etnaviv_obj->base.size,
 		etnaviv_obj->vaddr, etnaviv_obj->paddr);
 
 	drm_gem_object_release(obj);
 }
 
+static const struct etnaviv_gem_ops etnaviv_gem_cmd_ops = {
+	.release = etnaviv_gem_cmd_release,
+};
+
 static void etnaviv_free_obj(struct drm_gem_object *obj)
 {
 	struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
@@ -675,6 +684,7 @@ struct drm_gem_object *etnaviv_gem_new(struct drm_device *dev,
 
 	ret = 0;
 	if (flags & ETNA_BO_CMDSTREAM) {
+		to_etnaviv_bo(obj)->ops = &etnaviv_gem_cmd_ops;
 		drm_gem_private_object_init(dev, obj, size);
 	} else {
 		to_etnaviv_bo(obj)->ops = &etnaviv_gem_shmem_ops;
-- 
2.1.4



More information about the dri-devel mailing list