From patchwork Tue Jan 21 20:33:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 3519571 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4DD9AC02DC for ; Tue, 21 Jan 2014 20:33:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7989E2013A for ; Tue, 21 Jan 2014 20:33:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8B3D720155 for ; Tue, 21 Jan 2014 20:33:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E6EDFB5D1; Tue, 21 Jan 2014 12:33:29 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EA98FB5D1 for ; Tue, 21 Jan 2014 12:33:25 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 21 Jan 2014 12:33:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,697,1384329600"; d="scan'208";a="442459554" Received: from ironside.jf.intel.com ([10.7.197.221]) by orsmga001.jf.intel.com with ESMTP; 21 Jan 2014 12:33:23 -0800 From: Ben Widawsky To: DRI Development Subject: [PATCH 3/6] drm/radeon: Use new drm debugfs file helper Date: Tue, 21 Jan 2014 12:33:19 -0800 Message-Id: <1390336402-2049-3-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1390336402-2049-1-git-send-email-benjamin.widawsky@intel.com> References: <1389708847-25038-1-git-send-email-benjamin.widawsky@intel.com> <1390336402-2049-1-git-send-email-benjamin.widawsky@intel.com> MIME-Version: 1.0 Cc: Ben Widawsky , =?UTF-8?q?Christian=20K=C3=B6nig?= , Ben Widawsky X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 The debugfs helper duplicates the functionality used by Armada, so let's just use that. WARNING: only compile tested Cc: Christian König Signed-off-by: Ben Widawsky --- drivers/gpu/drm/radeon/radeon.h | 5 ----- drivers/gpu/drm/radeon/radeon_ttm.c | 43 ++++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index c5519ca..ceec468 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -418,11 +418,6 @@ struct radeon_mman { struct ttm_bo_device bdev; bool mem_global_referenced; bool initialized; - -#if defined(CONFIG_DEBUG_FS) - struct dentry *vram; - struct dentry *gtt; -#endif }; /* bo virtual address in a specific vm */ diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 77f5b0c..cf7caf2 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -971,27 +971,34 @@ static const struct file_operations radeon_ttm_gtt_fops = { .llseek = default_llseek }; +static const struct radeon_debugfs_files { + const char *name; + const struct file_operations *fops; +} radeon_debugfs_files[] = { + {"radeon_vram", &radeon_ttm_vram_fops}, + {"radeon_gtt", &radeon_ttm_gtt_fops}, +}; #endif static int radeon_ttm_debugfs_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) unsigned count; + int i, ret; struct drm_minor *minor = rdev->ddev->primary; - struct dentry *ent, *root = minor->debugfs_root; - - ent = debugfs_create_file("radeon_vram", S_IFREG | S_IRUGO, root, - rdev, &radeon_ttm_vram_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); - rdev->mman.vram = ent; - - ent = debugfs_create_file("radeon_gtt", S_IFREG | S_IRUGO, root, - rdev, &radeon_ttm_gtt_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); - rdev->mman.gtt = ent; + struct dentry *root = minor->debugfs_root; + + for (i = 0; i < ARRAY_SIZE(radeon_debugfs_files); i++) { + ret = drm_debugfs_create_file(root, minor, + radeon_debugfs_files[i].name, + radeon_debugfs_files[i].fops, + S_IFREG | S_IWUSR); + if (ret) { + radeon_ttm_debugfs_fini(rdev); + return ret; + } + } count = ARRAY_SIZE(radeon_ttm_debugfs_list); @@ -1010,11 +1017,13 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev) static void radeon_ttm_debugfs_fini(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) + int i; - debugfs_remove(rdev->mman.vram); - rdev->mman.vram = NULL; + for (i = 0; i < ARRAY_SIZE(radeon_debugfs_files); i++) { + struct drm_info_list *info_list = + (struct drm_info_list *)&radeon_debugfs_files[i]; - debugfs_remove(rdev->mman.gtt); - rdev->mman.gtt = NULL; + drm_debugfs_remove_files(info_list, 1, rdev->ddev->primary); + } #endif }