From patchwork Fri Mar 30 14:11:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 893345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40CNpS6gntz9s1r for ; Sat, 31 Mar 2018 01:11:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751263AbeC3OLo (ORCPT ); Fri, 30 Mar 2018 10:11:44 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58004 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbeC3OLn (ORCPT ); Fri, 30 Mar 2018 10:11:43 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 8C58D27792C From: Daniel Stone To: dri-devel@lists.freedesktop.org Cc: Thierry Reding , linux-tegra@vger.kernel.org Subject: [PATCH 11/24] drm/tegra: Remove duplicate framebuffer num_planes Date: Fri, 30 Mar 2018 15:11:25 +0100 Message-Id: <20180330141138.28987-11-daniels@collabora.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330141138.28987-1-daniels@collabora.com> References: <20180330141138.28987-1-daniels@collabora.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org drm_framebuffer already stores num_planes for us. Signed-off-by: Daniel Stone Cc: Thierry Reding Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/drm.h | 1 - drivers/gpu/drm/tegra/fb.c | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 4f41aaec8530..79340fb1de43 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -32,7 +32,6 @@ struct reset_control; struct tegra_fb { struct drm_framebuffer base; struct tegra_bo **planes; - unsigned int num_planes; }; #ifdef CONFIG_DRM_FBDEV_EMULATION diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index e69434909a42..75badf371721 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -107,7 +107,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) struct tegra_fb *fb = to_tegra_fb(framebuffer); unsigned int i; - for (i = 0; i < fb->num_planes; i++) { + for (i = 0; i < framebuffer->format->num_planes; i++) { struct tegra_bo *bo = fb->planes[i]; if (bo) { @@ -155,11 +155,9 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, return ERR_PTR(-ENOMEM); } - fb->num_planes = num_planes; - drm_helper_mode_fill_fb_struct(drm, &fb->base, mode_cmd); - for (i = 0; i < fb->num_planes; i++) + for (i = 0; i < fb->base.format->num_planes; i++) fb->planes[i] = planes[i]; err = drm_framebuffer_init(drm, &fb->base, &tegra_fb_funcs); From patchwork Fri Mar 30 14:11:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 893346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40CNpT4ynJz9sXB for ; Sat, 31 Mar 2018 01:11:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751271AbeC3OLo (ORCPT ); Fri, 30 Mar 2018 10:11:44 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58006 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbeC3OLn (ORCPT ); Fri, 30 Mar 2018 10:11:43 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id AD3E7277939 From: Daniel Stone To: dri-devel@lists.freedesktop.org Cc: Thierry Reding , linux-tegra@vger.kernel.org Subject: [PATCH 12/24] drm/tegra: Move GEM BOs to drm_framebuffer Date: Fri, 30 Mar 2018 15:11:26 +0100 Message-Id: <20180330141138.28987-12-daniels@collabora.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330141138.28987-1-daniels@collabora.com> References: <20180330141138.28987-1-daniels@collabora.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Since drm_framebuffer can now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffer create_handle function the same as the GEM framebuffer helper, we can reuse that. Signed-off-by: Daniel Stone Cc: Thierry Reding Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/drm.h | 1 - drivers/gpu/drm/tegra/fb.c | 37 ++++++++----------------------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 79340fb1de43..025e011d74af 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -31,7 +31,6 @@ struct reset_control; struct tegra_fb { struct drm_framebuffer base; - struct tegra_bo **planes; }; #ifdef CONFIG_DRM_FBDEV_EMULATION diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 75badf371721..5bc8f968284c 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -14,6 +14,7 @@ #include "drm.h" #include "gem.h" +#include static inline struct tegra_fb *to_tegra_fb(struct drm_framebuffer *fb) { @@ -30,19 +31,14 @@ static inline struct tegra_fbdev *to_tegra_fbdev(struct drm_fb_helper *helper) struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer, unsigned int index) { - struct tegra_fb *fb = to_tegra_fb(framebuffer); - - if (index >= framebuffer->format->num_planes) - return NULL; - - return fb->planes[index]; + return to_tegra_bo(drm_gem_fb_get_obj(framebuffer, index)); } bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer) { - struct tegra_fb *fb = to_tegra_fb(framebuffer); + struct tegra_bo *bo = tegra_fb_get_plane(framebuffer, 0); - if (fb->planes[0]->flags & TEGRA_BO_BOTTOM_UP) + if (bo->flags & TEGRA_BO_BOTTOM_UP) return true; return false; @@ -51,8 +47,7 @@ bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer) int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, struct tegra_bo_tiling *tiling) { - struct tegra_fb *fb = to_tegra_fb(framebuffer); - uint64_t modifier = fb->base.modifier; + uint64_t modifier = framebuffer->modifier; switch (modifier) { case DRM_FORMAT_MOD_LINEAR: @@ -108,7 +103,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) unsigned int i; for (i = 0; i < framebuffer->format->num_planes; i++) { - struct tegra_bo *bo = fb->planes[i]; + struct tegra_bo *bo = tegra_fb_get_plane(framebuffer, i); if (bo) { if (bo->pages) @@ -119,21 +114,12 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) } drm_framebuffer_cleanup(framebuffer); - kfree(fb->planes); kfree(fb); } -static int tegra_fb_create_handle(struct drm_framebuffer *framebuffer, - struct drm_file *file, unsigned int *handle) -{ - struct tegra_fb *fb = to_tegra_fb(framebuffer); - - return drm_gem_handle_create(file, &fb->planes[0]->gem, handle); -} - static const struct drm_framebuffer_funcs tegra_fb_funcs = { .destroy = tegra_fb_destroy, - .create_handle = tegra_fb_create_handle, + .create_handle = drm_gem_fb_create_handle, }; static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, @@ -149,22 +135,15 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, if (!fb) return ERR_PTR(-ENOMEM); - fb->planes = kzalloc(num_planes * sizeof(*planes), GFP_KERNEL); - if (!fb->planes) { - kfree(fb); - return ERR_PTR(-ENOMEM); - } - drm_helper_mode_fill_fb_struct(drm, &fb->base, mode_cmd); for (i = 0; i < fb->base.format->num_planes; i++) - fb->planes[i] = planes[i]; + fb->base.obj[i] = &planes[i]->gem; err = drm_framebuffer_init(drm, &fb->base, &tegra_fb_funcs); if (err < 0) { dev_err(drm->dev, "failed to initialize framebuffer: %d\n", err); - kfree(fb->planes); kfree(fb); return ERR_PTR(err); } From patchwork Fri Mar 30 14:11:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 893348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40CNpW3X9Zz9sX8 for ; Sat, 31 Mar 2018 01:11:47 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751259AbeC3OLp (ORCPT ); Fri, 30 Mar 2018 10:11:45 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58012 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751241AbeC3OLo (ORCPT ); Fri, 30 Mar 2018 10:11:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id CB6DA27794F From: Daniel Stone To: dri-devel@lists.freedesktop.org Cc: Thierry Reding , linux-tegra@vger.kernel.org Subject: [PATCH 13/24] drm/tegra: tegra_fb -> drm_framebuffer Date: Fri, 30 Mar 2018 15:11:27 +0100 Message-Id: <20180330141138.28987-13-daniels@collabora.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330141138.28987-1-daniels@collabora.com> References: <20180330141138.28987-1-daniels@collabora.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Since tegra_fb is now the same as drm_framebuffer, we can just replace the type completely. Signed-off-by: Daniel Stone Cc: Thierry Reding Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/drm.h | 6 +----- drivers/gpu/drm/tegra/fb.c | 34 ++++++++++++++-------------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 025e011d74af..f1fc2cfc8f02 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -29,14 +29,10 @@ struct reset_control; -struct tegra_fb { - struct drm_framebuffer base; -}; - #ifdef CONFIG_DRM_FBDEV_EMULATION struct tegra_fbdev { struct drm_fb_helper base; - struct tegra_fb *fb; + struct drm_framebuffer *fb; }; #endif diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 5bc8f968284c..57da9683a713 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -16,11 +16,6 @@ #include "gem.h" #include -static inline struct tegra_fb *to_tegra_fb(struct drm_framebuffer *fb) -{ - return container_of(fb, struct tegra_fb, base); -} - #ifdef CONFIG_DRM_FBDEV_EMULATION static inline struct tegra_fbdev *to_tegra_fbdev(struct drm_fb_helper *helper) { @@ -99,7 +94,6 @@ int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) { - struct tegra_fb *fb = to_tegra_fb(framebuffer); unsigned int i; for (i = 0; i < framebuffer->format->num_planes; i++) { @@ -114,7 +108,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) } drm_framebuffer_cleanup(framebuffer); - kfree(fb); + kfree(framebuffer); } static const struct drm_framebuffer_funcs tegra_fb_funcs = { @@ -122,12 +116,12 @@ static const struct drm_framebuffer_funcs tegra_fb_funcs = { .create_handle = drm_gem_fb_create_handle, }; -static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, - const struct drm_mode_fb_cmd2 *mode_cmd, - struct tegra_bo **planes, - unsigned int num_planes) +static struct drm_framebuffer *tegra_fb_alloc(struct drm_device *drm, + const struct drm_mode_fb_cmd2 *mode_cmd, + struct tegra_bo **planes, + unsigned int num_planes) { - struct tegra_fb *fb; + struct drm_framebuffer *fb; unsigned int i; int err; @@ -135,12 +129,12 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, if (!fb) return ERR_PTR(-ENOMEM); - drm_helper_mode_fill_fb_struct(drm, &fb->base, mode_cmd); + drm_helper_mode_fill_fb_struct(drm, fb, mode_cmd); - for (i = 0; i < fb->base.format->num_planes; i++) - fb->base.obj[i] = &planes[i]->gem; + for (i = 0; i < fb->format->num_planes; i++) + fb->obj[i] = &planes[i]->gem; - err = drm_framebuffer_init(drm, &fb->base, &tegra_fb_funcs); + err = drm_framebuffer_init(drm, fb, &tegra_fb_funcs); if (err < 0) { dev_err(drm->dev, "failed to initialize framebuffer: %d\n", err); @@ -158,7 +152,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm, unsigned int hsub, vsub, i; struct tegra_bo *planes[4]; struct drm_gem_object *gem; - struct tegra_fb *fb; + struct drm_framebuffer *fb; int err; hsub = drm_format_horz_chroma_subsampling(cmd->pixel_format); @@ -194,7 +188,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm, goto unreference; } - return &fb->base; + return fb; unreference: while (i--) @@ -275,7 +269,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, return PTR_ERR(fbdev->fb); } - fb = &fbdev->fb->base; + fb = fbdev->fb; helper->fb = fb; helper->fbdev = info; @@ -376,7 +370,7 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev) drm_fb_helper_unregister_fbi(&fbdev->base); if (fbdev->fb) - drm_framebuffer_remove(&fbdev->fb->base); + drm_framebuffer_remove(fbdev->fb); drm_fb_helper_fini(&fbdev->base); tegra_fbdev_free(fbdev); From patchwork Fri Mar 30 14:11:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 893349 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40CNpX13HZz9s1r for ; Sat, 31 Mar 2018 01:11:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751280AbeC3OLq (ORCPT ); Fri, 30 Mar 2018 10:11:46 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58016 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751250AbeC3OLo (ORCPT ); Fri, 30 Mar 2018 10:11:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id E9D862779FB From: Daniel Stone To: dri-devel@lists.freedesktop.org Cc: Thierry Reding , linux-tegra@vger.kernel.org Subject: [PATCH 14/24] drm/tegra: Move fbdev unmap special case Date: Fri, 30 Mar 2018 15:11:28 +0100 Message-Id: <20180330141138.28987-14-daniels@collabora.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330141138.28987-1-daniels@collabora.com> References: <20180330141138.28987-1-daniels@collabora.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org User framebuffers are created with either bo->pages or bo->vaddr set, depending on whether or not an IOMMU is present. On the other hand, the framebuffer created for fbdev emulation has a vaddr mapping made if bo->pages is set after creation. This is set up in fbdev probe. Remove the special case unmapping from the general-purpose framebuffer destroy, and move it to fbdev teardown. Signed-off-by: Daniel Stone Cc: Thierry Reding Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/fb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 57da9683a713..709aa6ef171a 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -99,12 +99,8 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) for (i = 0; i < framebuffer->format->num_planes; i++) { struct tegra_bo *bo = tegra_fb_get_plane(framebuffer, i); - if (bo) { - if (bo->pages) - vunmap(bo->vaddr); - + if (bo) drm_gem_object_put_unlocked(&bo->gem); - } } drm_framebuffer_cleanup(framebuffer); @@ -369,8 +365,17 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev) { drm_fb_helper_unregister_fbi(&fbdev->base); - if (fbdev->fb) + if (fbdev->fb) { + struct tegra_bo *bo = tegra_fb_get_plane(fbdev->fb, 0); + + /* Undo the special mapping we made in fbdev probe. */ + if (bo && bo->pages) { + vunmap(bo->vaddr); + bo->vaddr = 0; + } + drm_framebuffer_remove(fbdev->fb); + } drm_fb_helper_fini(&fbdev->base); tegra_fbdev_free(fbdev); From patchwork Fri Mar 30 14:11:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 893347 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40CNpV5kJRz9s1r for ; Sat, 31 Mar 2018 01:11:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751216AbeC3OLp (ORCPT ); Fri, 30 Mar 2018 10:11:45 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58024 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbeC3OLo (ORCPT ); Fri, 30 Mar 2018 10:11:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 162EB277A12 From: Daniel Stone To: dri-devel@lists.freedesktop.org Cc: Thierry Reding , linux-tegra@vger.kernel.org Subject: [PATCH 15/24] drm/tegra: Use drm_gem_fb_destroy Date: Fri, 30 Mar 2018 15:11:29 +0100 Message-Id: <20180330141138.28987-15-daniels@collabora.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330141138.28987-1-daniels@collabora.com> References: <20180330141138.28987-1-daniels@collabora.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Now that our destroy function is the same as the helper, use that directly. Signed-off-by: Daniel Stone Cc: Thierry Reding Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/fb.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 709aa6ef171a..4c22cdded3c2 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -92,23 +92,8 @@ int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, return 0; } -static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) -{ - unsigned int i; - - for (i = 0; i < framebuffer->format->num_planes; i++) { - struct tegra_bo *bo = tegra_fb_get_plane(framebuffer, i); - - if (bo) - drm_gem_object_put_unlocked(&bo->gem); - } - - drm_framebuffer_cleanup(framebuffer); - kfree(framebuffer); -} - static const struct drm_framebuffer_funcs tegra_fb_funcs = { - .destroy = tegra_fb_destroy, + .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, };