From: "Christian König" <christian.koenig@amd.com>
To: Ben Widawsky <benjamin.widawsky@intel.com>,
DRI Development <dri-devel@lists.freedesktop.org>
Cc: Ben Widawsky <ben@bwidawsk.net>
Subject: Re: [PATCH 3/6] drm/radeon: Use new drm debugfs file helper
Date: Wed, 22 Jan 2014 11:11:10 +0100 [thread overview]
Message-ID: <52DF993E.6070203@amd.com> (raw)
In-Reply-To: <1390336402-2049-3-git-send-email-benjamin.widawsky@intel.com>
Am 21.01.2014 21:33, schrieb Ben Widawsky:
> The debugfs helper duplicates the functionality used by Armada, so let's
> just use that.
>
> WARNING: only compile tested
>
> Cc: Christian König <christian.koenig@amd.com>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> ---
> 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);
This won't work correctly because info_ent doesn't contain this pointer
but a pointer to the fops instead. Additional to that the fops might not
be unique (you can use the same fops for different files) so they are
probably not such a good choice as the key.
On the other hand why do the drm layer want to do this bookkeeping of
all the created files in the first place? We could just use
debugfs_remove_recursive instead and don't need to mess with this at all.
Regards,
Christian.
> + }
> #endif
> }
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-01-22 10:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 14:14 [PATCH 1/2] drm: share drm_add_fake_info_node Ben Widawsky
2014-01-14 14:14 ` Ben Widawsky
2014-01-14 14:14 ` [PATCH 2/2] drm/i915: Move pipecrc debug functions to new file Ben Widawsky
2014-01-14 23:28 ` Daniel Vetter
2014-01-15 1:22 ` Damien Lespiau
2014-01-15 8:46 ` Daniel Vetter
2014-01-15 20:04 ` Ben Widawsky
2014-01-14 23:25 ` [Intel-gfx] [PATCH 1/2] drm: share drm_add_fake_info_node Daniel Vetter
2014-01-14 23:25 ` Daniel Vetter
2014-01-14 23:40 ` Russell King - ARM Linux
2014-01-14 23:40 ` Russell King - ARM Linux
2014-01-15 8:39 ` [Intel-gfx] " Daniel Vetter
2014-01-15 8:39 ` Daniel Vetter
2014-01-15 8:45 ` Daniel Vetter
2014-01-15 8:45 ` Daniel Vetter
2014-01-15 20:08 ` [Intel-gfx] " Ben Widawsky
2014-01-15 20:08 ` Ben Widawsky
2014-01-15 23:42 ` [Intel-gfx] " Daniel Vetter
2014-01-15 23:42 ` Daniel Vetter
2014-01-21 19:05 ` Ben Widawsky
2014-01-21 19:05 ` Ben Widawsky
2014-01-21 20:33 ` [PATCH 1/6] drm: Create a debugfs file creation helper Ben Widawsky
2014-01-21 20:33 ` Ben Widawsky
2014-01-21 20:33 ` [PATCH 2/6] drm/armada: Use new drm debugfs file helper Ben Widawsky
2014-01-21 20:33 ` Ben Widawsky
2014-01-21 20:33 ` [PATCH 3/6] drm/radeon: " Ben Widawsky
2014-01-22 10:11 ` Christian König [this message]
2014-01-23 3:20 ` Ben Widawsky
2014-01-23 10:57 ` Christian König
2014-01-21 20:33 ` [PATCH 4/6] drm/i915: " Ben Widawsky
2014-01-21 20:33 ` [PATCH 5/6] drm/i915: Move forcewake debugfs setup also Ben Widawsky
2014-01-21 20:33 ` [PATCH 6/6] drm/i915: Move pipecrc debug functions to new file Ben Widawsky
2014-01-21 21:44 ` Damien Lespiau
2014-01-21 21:50 ` Damien Lespiau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52DF993E.6070203@amd.com \
--to=christian.koenig@amd.com \
--cc=ben@bwidawsk.net \
--cc=benjamin.widawsky@intel.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.