From 2fa54c94a67e13d84df980d646674dde0ad27168 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 21 Sep 2016 14:24:59 -0700 Subject: gpu: nvgpu: Remove global debugfs variable Remove a global debugfs variable and instead save the allocator debugfs root node in the gk20a struct. Bug 1799159 Change-Id: If4eed34fa24775e962001e34840b334658f2321c Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1225611 (cherry picked from commit 1908fde10bb1fb60ce898ea329f5a441a3e4297a) Reviewed-on: http://git-master/r/1242390 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a_allocator.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_allocator.c') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c index 15d5b732..3129b07c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c @@ -19,14 +19,13 @@ #include #include +#include "gk20a.h" #include "mm_gk20a.h" #include "platform_gk20a.h" #include "gk20a_allocator.h" u32 gk20a_alloc_tracing_on; -static struct dentry *gk20a_alloc_debugfs_root; - u64 gk20a_alloc_length(struct gk20a_allocator *a) { if (a->ops->length) @@ -152,6 +151,7 @@ void gk20a_alloc_print_stats(struct gk20a_allocator *__a, __a->ops->print_stats(__a, s, lock); } +#ifdef CONFIG_DEBUG_FS static int __alloc_show(struct seq_file *s, void *unused) { struct gk20a_allocator *a = s->private; @@ -172,35 +172,40 @@ static const struct file_operations __alloc_fops = { .llseek = seq_lseek, .release = single_release, }; +#endif -void gk20a_init_alloc_debug(struct gk20a_allocator *a) +void gk20a_init_alloc_debug(struct gk20a *g, struct gk20a_allocator *a) { - if (!gk20a_alloc_debugfs_root) +#ifdef CONFIG_DEBUG_FS + if (!g->debugfs_allocators) return; a->debugfs_entry = debugfs_create_file(a->name, S_IRUGO, - gk20a_alloc_debugfs_root, + g->debugfs_allocators, a, &__alloc_fops); +#endif } void gk20a_fini_alloc_debug(struct gk20a_allocator *a) { - if (!gk20a_alloc_debugfs_root) - return; - +#ifdef CONFIG_DEBUG_FS if (!IS_ERR_OR_NULL(a->debugfs_entry)) debugfs_remove(a->debugfs_entry); +#endif } void gk20a_alloc_debugfs_init(struct device *dev) { +#ifdef CONFIG_DEBUG_FS struct gk20a_platform *platform = dev_get_drvdata(dev); struct dentry *gpu_root = platform->debugfs; + struct gk20a *g = get_gk20a(dev); - gk20a_alloc_debugfs_root = debugfs_create_dir("allocators", gpu_root); - if (IS_ERR_OR_NULL(gk20a_alloc_debugfs_root)) + g->debugfs_allocators = debugfs_create_dir("allocators", gpu_root); + if (IS_ERR_OR_NULL(g->debugfs_allocators)) return; - debugfs_create_u32("tracing", 0664, gk20a_alloc_debugfs_root, + debugfs_create_u32("tracing", 0664, g->debugfs_allocators, &gk20a_alloc_tracing_on); +#endif } -- cgit v1.2.2