diff mbox

[RFC,037/111] staging: etnaviv: clean up etnaviv_gem_free_object()

Message ID 1427988653-754-38-git-send-email-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach April 2, 2015, 3:29 p.m. UTC
From: Russell King <rmk+kernel@arm.linux.org.uk>

As the tail of etnaviv_free_obj() is identical to etnaviv_free_cmd(),
we can eliminate etnaviv_free_obj() entirely by moving it into
etnaviv_gem_free_object().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_gem.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c
index 824338e0068d..0a0cf92ff13f 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.c
+++ b/drivers/staging/etnaviv/etnaviv_gem.c
@@ -508,15 +508,6 @@  void msm_gem_describe_objects(struct list_head *list, struct seq_file *m)
 }
 #endif
 
-static void etnaviv_free_cmd(struct drm_gem_object *obj)
-{
-	struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
-
-	drm_gem_free_mmap_offset(obj);
-
-	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,
@@ -540,10 +531,6 @@  static void etnaviv_free_obj(struct drm_gem_object *obj)
 		drm_mm_remove_node(etnaviv_obj->gpu_vram_node);
 		kfree(etnaviv_obj->gpu_vram_node);
 	}
-
-	drm_gem_free_mmap_offset(obj);
-
-	etnaviv_obj->ops->release(etnaviv_obj);
 }
 
 static void etnaviv_gem_shmem_release(struct etnaviv_gem_object *etnaviv_obj)
@@ -569,11 +556,11 @@  void etnaviv_gem_free_object(struct drm_gem_object *obj)
 
 	list_del(&etnaviv_obj->mm_list);
 
-	if (etnaviv_obj->flags & ETNA_BO_CMDSTREAM)
-		etnaviv_free_cmd(obj);
-	else
+	if (!(etnaviv_obj->flags & ETNA_BO_CMDSTREAM))
 		etnaviv_free_obj(obj);
 
+	drm_gem_free_mmap_offset(obj);
+	etnaviv_obj->ops->release(etnaviv_obj);
 	reservation_object_fini(&etnaviv_obj->_resv);
 	drm_gem_object_release(obj);