From patchwork Thu Apr 2 15:29:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 6149261 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E14999F440 for ; Thu, 2 Apr 2015 15:31:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 194A3203B5 for ; Thu, 2 Apr 2015 15:31:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 51983203AE for ; Thu, 2 Apr 2015 15:31:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1A066EA59; Thu, 2 Apr 2015 08:30:59 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A86B6EA42 for ; Thu, 2 Apr 2015 08:30:58 -0700 (PDT) Received: from dude.hi.4.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Ydh57-0005OD-Ax; Thu, 02 Apr 2015 17:30:57 +0200 From: Lucas Stach To: dri-devel@lists.freedesktop.org Subject: [PATCH RFC 037/111] staging: etnaviv: clean up etnaviv_gem_free_object() Date: Thu, 2 Apr 2015 17:29:39 +0200 Message-Id: <1427988653-754-38-git-send-email-l.stach@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427988653-754-1-git-send-email-l.stach@pengutronix.de> References: <1427988653-754-1-git-send-email-l.stach@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org Cc: Russell King , kernel@pengutronix.de X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King 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 --- drivers/staging/etnaviv/etnaviv_gem.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) 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);