diff options
author | Alex Waterman <alexw@nvidia.com> | 2016-09-21 17:24:59 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-10-26 14:10:01 -0400 |
commit | 2fa54c94a67e13d84df980d646674dde0ad27168 (patch) | |
tree | 2bf49a012542caa2ad278392b313305f74fe96f6 /drivers/gpu/nvgpu/gk20a/gk20a_allocator.c | |
parent | 93eea1d72934b28db4707e5aa7ab4dab65d89551 (diff) |
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 <alexw@nvidia.com>
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 <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_allocator.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_allocator.c | 27 |
1 files changed, 16 insertions, 11 deletions
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 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | 21 | ||
22 | #include "gk20a.h" | ||
22 | #include "mm_gk20a.h" | 23 | #include "mm_gk20a.h" |
23 | #include "platform_gk20a.h" | 24 | #include "platform_gk20a.h" |
24 | #include "gk20a_allocator.h" | 25 | #include "gk20a_allocator.h" |
25 | 26 | ||
26 | u32 gk20a_alloc_tracing_on; | 27 | u32 gk20a_alloc_tracing_on; |
27 | 28 | ||
28 | static struct dentry *gk20a_alloc_debugfs_root; | ||
29 | |||
30 | u64 gk20a_alloc_length(struct gk20a_allocator *a) | 29 | u64 gk20a_alloc_length(struct gk20a_allocator *a) |
31 | { | 30 | { |
32 | if (a->ops->length) | 31 | if (a->ops->length) |
@@ -152,6 +151,7 @@ void gk20a_alloc_print_stats(struct gk20a_allocator *__a, | |||
152 | __a->ops->print_stats(__a, s, lock); | 151 | __a->ops->print_stats(__a, s, lock); |
153 | } | 152 | } |
154 | 153 | ||
154 | #ifdef CONFIG_DEBUG_FS | ||
155 | static int __alloc_show(struct seq_file *s, void *unused) | 155 | static int __alloc_show(struct seq_file *s, void *unused) |
156 | { | 156 | { |
157 | struct gk20a_allocator *a = s->private; | 157 | struct gk20a_allocator *a = s->private; |
@@ -172,35 +172,40 @@ static const struct file_operations __alloc_fops = { | |||
172 | .llseek = seq_lseek, | 172 | .llseek = seq_lseek, |
173 | .release = single_release, | 173 | .release = single_release, |
174 | }; | 174 | }; |
175 | #endif | ||
175 | 176 | ||
176 | void gk20a_init_alloc_debug(struct gk20a_allocator *a) | 177 | void gk20a_init_alloc_debug(struct gk20a *g, struct gk20a_allocator *a) |
177 | { | 178 | { |
178 | if (!gk20a_alloc_debugfs_root) | 179 | #ifdef CONFIG_DEBUG_FS |
180 | if (!g->debugfs_allocators) | ||
179 | return; | 181 | return; |
180 | 182 | ||
181 | a->debugfs_entry = debugfs_create_file(a->name, S_IRUGO, | 183 | a->debugfs_entry = debugfs_create_file(a->name, S_IRUGO, |
182 | gk20a_alloc_debugfs_root, | 184 | g->debugfs_allocators, |
183 | a, &__alloc_fops); | 185 | a, &__alloc_fops); |
186 | #endif | ||
184 | } | 187 | } |
185 | 188 | ||
186 | void gk20a_fini_alloc_debug(struct gk20a_allocator *a) | 189 | void gk20a_fini_alloc_debug(struct gk20a_allocator *a) |
187 | { | 190 | { |
188 | if (!gk20a_alloc_debugfs_root) | 191 | #ifdef CONFIG_DEBUG_FS |
189 | return; | ||
190 | |||
191 | if (!IS_ERR_OR_NULL(a->debugfs_entry)) | 192 | if (!IS_ERR_OR_NULL(a->debugfs_entry)) |
192 | debugfs_remove(a->debugfs_entry); | 193 | debugfs_remove(a->debugfs_entry); |
194 | #endif | ||
193 | } | 195 | } |
194 | 196 | ||
195 | void gk20a_alloc_debugfs_init(struct device *dev) | 197 | void gk20a_alloc_debugfs_init(struct device *dev) |
196 | { | 198 | { |
199 | #ifdef CONFIG_DEBUG_FS | ||
197 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 200 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
198 | struct dentry *gpu_root = platform->debugfs; | 201 | struct dentry *gpu_root = platform->debugfs; |
202 | struct gk20a *g = get_gk20a(dev); | ||
199 | 203 | ||
200 | gk20a_alloc_debugfs_root = debugfs_create_dir("allocators", gpu_root); | 204 | g->debugfs_allocators = debugfs_create_dir("allocators", gpu_root); |
201 | if (IS_ERR_OR_NULL(gk20a_alloc_debugfs_root)) | 205 | if (IS_ERR_OR_NULL(g->debugfs_allocators)) |
202 | return; | 206 | return; |
203 | 207 | ||
204 | debugfs_create_u32("tracing", 0664, gk20a_alloc_debugfs_root, | 208 | debugfs_create_u32("tracing", 0664, g->debugfs_allocators, |
205 | &gk20a_alloc_tracing_on); | 209 | &gk20a_alloc_tracing_on); |
210 | #endif | ||
206 | } | 211 | } |