summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-04-21 15:42:57 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-24 14:05:17 -0400
commitb3e1ce04b963e91b9b425b3c35cc4eff11db7543 (patch)
tree73c45d0acfe3ce25298ba1dc8dfa4777e02c861a /drivers/gpu/nvgpu/common
parentb88c9ad793cb9822f359b8c498afe872c412959c (diff)
gpu: nvgpu: Put debugfs dependencies inside #ifdef
Put all debugfs dependencies inside #ifdef CONFIG_DEBUG_FS. This includes some functions in allocators that were used only for debugging. Remove include of linux/debugfs.h on files that do not deal with debugfs. linux/debugfs.h implicitly included linux/fs.h, which we relied on. Add explicit include of linux/fs.h for all files where this is the case. Change-Id: I16feffae6b0e3a2edf366075cdc01ade86be06f9 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1467897 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_as.c1
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c1
-rw-r--r--drivers/gpu/nvgpu/common/linux/kmem.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c2
-rw-r--r--drivers/gpu/nvgpu/common/mm/bitmap_allocator.c4
-rw-r--r--drivers/gpu/nvgpu/common/mm/buddy_allocator.c4
-rw-r--r--drivers/gpu/nvgpu/common/mm/lockless_allocator.c6
-rw-r--r--drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c2
-rw-r--r--drivers/gpu/nvgpu/common/mm/page_allocator.c4
10 files changed, 26 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_as.c b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
index d9316c7f..6a9d3811 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_as.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/cdev.h> 16#include <linux/cdev.h>
17#include <linux/uaccess.h> 17#include <linux/uaccess.h>
18#include <linux/fs.h>
18 19
19#include <nvgpu/log2.h> 20#include <nvgpu/log2.h>
20 21
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index 0546658d..97e911b9 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -18,6 +18,7 @@
18#include <linux/cdev.h> 18#include <linux/cdev.h>
19#include <linux/file.h> 19#include <linux/file.h>
20#include <linux/anon_inodes.h> 20#include <linux/anon_inodes.h>
21#include <linux/fs.h>
21#include <uapi/linux/nvgpu.h> 22#include <uapi/linux/nvgpu.h>
22 23
23#include <nvgpu/bitops.h> 24#include <nvgpu/bitops.h>
diff --git a/drivers/gpu/nvgpu/common/linux/kmem.c b/drivers/gpu/nvgpu/common/linux/kmem.c
index 4fe68830..f38a5e78 100644
--- a/drivers/gpu/nvgpu/common/linux/kmem.c
+++ b/drivers/gpu/nvgpu/common/linux/kmem.c
@@ -479,6 +479,7 @@ static void print_histogram(struct nvgpu_mem_alloc_tracker *tracker,
479 } 479 }
480} 480}
481 481
482#ifdef CONFIG_DEBUG_FS
482/** 483/**
483 * nvgpu_kmem_print_stats - Print kmem tracking stats. 484 * nvgpu_kmem_print_stats - Print kmem tracking stats.
484 * 485 *
@@ -515,7 +516,6 @@ void nvgpu_kmem_print_stats(struct nvgpu_mem_alloc_tracker *tracker,
515 unlock_tracker(tracker); 516 unlock_tracker(tracker);
516} 517}
517 518
518#if defined(CONFIG_DEBUG_FS)
519static int __kmem_tracking_show(struct seq_file *s, void *unused) 519static int __kmem_tracking_show(struct seq_file *s, void *unused)
520{ 520{
521 struct nvgpu_mem_alloc_tracker *tracker = s->private; 521 struct nvgpu_mem_alloc_tracker *tracker = s->private;
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index 79d6bd5f..ebc25a26 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -615,9 +615,9 @@ static int gk20a_pm_unrailgate(struct device *dev)
615{ 615{
616 struct gk20a_platform *platform = dev_get_drvdata(dev); 616 struct gk20a_platform *platform = dev_get_drvdata(dev);
617 int ret = 0; 617 int ret = 0;
618#ifdef CONFIG_DEBUG_FS
618 struct gk20a *g = get_gk20a(dev); 619 struct gk20a *g = get_gk20a(dev);
619 620
620#ifdef CONFIG_DEBUG_FS
621 g->pstats.last_rail_ungate_start = jiffies; 621 g->pstats.last_rail_ungate_start = jiffies;
622 if (g->pstats.railgating_cycle_count >= 1) 622 if (g->pstats.railgating_cycle_count >= 1)
623 g->pstats.total_rail_gate_time_ms = 623 g->pstats.total_rail_gate_time_ms =
@@ -974,8 +974,10 @@ static int __exit gk20a_remove(struct platform_device *pdev)
974 974
975 gk20a_user_deinit(dev, &nvgpu_class); 975 gk20a_user_deinit(dev, &nvgpu_class);
976 976
977#ifdef CONFIG_DEBUG_FS
977 debugfs_remove_recursive(platform->debugfs); 978 debugfs_remove_recursive(platform->debugfs);
978 debugfs_remove_recursive(platform->debugfs_alias); 979 debugfs_remove_recursive(platform->debugfs_alias);
980#endif
979 981
980 gk20a_remove_sysfs(dev); 982 gk20a_remove_sysfs(dev);
981 983
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index 0bad2b67..b4e6cb7c 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -463,8 +463,10 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
463 gk20a_user_deinit(g->dev, &nvgpu_pci_class); 463 gk20a_user_deinit(g->dev, &nvgpu_pci_class);
464 gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b"); 464 gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b");
465 465
466#ifdef CONFIG_DEBUG_FS
466 debugfs_remove_recursive(platform->debugfs); 467 debugfs_remove_recursive(platform->debugfs);
467 debugfs_remove_recursive(platform->debugfs_alias); 468 debugfs_remove_recursive(platform->debugfs_alias);
469#endif
468 470
469 gk20a_remove_sysfs(g->dev); 471 gk20a_remove_sysfs(g->dev);
470 472
diff --git a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c
index 4b44bd7e..40ee199a 100644
--- a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c
@@ -310,6 +310,7 @@ static void nvgpu_bitmap_alloc_destroy(struct nvgpu_allocator *__a)
310 nvgpu_kfree(nvgpu_alloc_to_gpu(__a), a); 310 nvgpu_kfree(nvgpu_alloc_to_gpu(__a), a);
311} 311}
312 312
313#ifdef CONFIG_DEBUG_FS
313static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a, 314static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a,
314 struct seq_file *s, int lock) 315 struct seq_file *s, int lock)
315{ 316{
@@ -329,6 +330,7 @@ static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a,
329 __alloc_pstat(s, __a, " Outstanding = 0x%llx\n", 330 __alloc_pstat(s, __a, " Outstanding = 0x%llx\n",
330 a->bytes_alloced - a->bytes_freed); 331 a->bytes_alloced - a->bytes_freed);
331} 332}
333#endif
332 334
333static const struct nvgpu_allocator_ops bitmap_ops = { 335static const struct nvgpu_allocator_ops bitmap_ops = {
334 .alloc = nvgpu_bitmap_alloc, 336 .alloc = nvgpu_bitmap_alloc,
@@ -344,7 +346,9 @@ static const struct nvgpu_allocator_ops bitmap_ops = {
344 346
345 .fini = nvgpu_bitmap_alloc_destroy, 347 .fini = nvgpu_bitmap_alloc_destroy,
346 348
349#ifdef CONFIG_DEBUG_FS
347 .print_stats = nvgpu_bitmap_print_stats, 350 .print_stats = nvgpu_bitmap_print_stats,
351#endif
348}; 352};
349 353
350 354
diff --git a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c
index 44e8edb2..34bc51df 100644
--- a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c
@@ -1086,6 +1086,7 @@ static u64 nvgpu_buddy_alloc_space(struct nvgpu_allocator *a)
1086 return space; 1086 return space;
1087} 1087}
1088 1088
1089#ifdef CONFIG_DEBUG_FS
1089/* 1090/*
1090 * Print the buddy allocator top level stats. If you pass @s as NULL then the 1091 * Print the buddy allocator top level stats. If you pass @s as NULL then the
1091 * stats are printed to the kernel log. This lets this code be used for 1092 * stats are printed to the kernel log. This lets this code be used for
@@ -1163,6 +1164,7 @@ static void nvgpu_buddy_print_stats(struct nvgpu_allocator *__a,
1163 if (lock) 1164 if (lock)
1164 alloc_unlock(__a); 1165 alloc_unlock(__a);
1165} 1166}
1167#endif
1166 1168
1167static const struct nvgpu_allocator_ops buddy_ops = { 1169static const struct nvgpu_allocator_ops buddy_ops = {
1168 .alloc = nvgpu_buddy_balloc, 1170 .alloc = nvgpu_buddy_balloc,
@@ -1182,7 +1184,9 @@ static const struct nvgpu_allocator_ops buddy_ops = {
1182 1184
1183 .fini = nvgpu_buddy_allocator_destroy, 1185 .fini = nvgpu_buddy_allocator_destroy,
1184 1186
1187#ifdef CONFIG_DEBUG_FS
1185 .print_stats = nvgpu_buddy_print_stats, 1188 .print_stats = nvgpu_buddy_print_stats,
1189#endif
1186}; 1190};
1187 1191
1188/* 1192/*
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
index dc72d8bf..d8043c0b 100644
--- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -106,6 +106,7 @@ static void nvgpu_lockless_alloc_destroy(struct nvgpu_allocator *a)
106 nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa); 106 nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa);
107} 107}
108 108
109#ifdef CONFIG_DEBUG_FS
109static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a, 110static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a,
110 struct seq_file *s, int lock) 111 struct seq_file *s, int lock)
111{ 112{
@@ -122,6 +123,7 @@ static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a,
122 __alloc_pstat(s, a, " Number free = %d\n", 123 __alloc_pstat(s, a, " Number free = %d\n",
123 pa->nr_nodes - atomic_read(&pa->nr_allocs)); 124 pa->nr_nodes - atomic_read(&pa->nr_allocs));
124} 125}
126#endif
125 127
126static const struct nvgpu_allocator_ops pool_ops = { 128static const struct nvgpu_allocator_ops pool_ops = {
127 .alloc = nvgpu_lockless_alloc, 129 .alloc = nvgpu_lockless_alloc,
@@ -134,7 +136,9 @@ static const struct nvgpu_allocator_ops pool_ops = {
134 136
135 .fini = nvgpu_lockless_alloc_destroy, 137 .fini = nvgpu_lockless_alloc_destroy,
136 138
139#ifdef CONFIG_DEBUG_FS
137 .print_stats = nvgpu_lockless_print_stats, 140 .print_stats = nvgpu_lockless_print_stats,
141#endif
138}; 142};
139 143
140int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, 144int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
diff --git a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c
index b84855b5..115a0904 100644
--- a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c
@@ -150,13 +150,13 @@ int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, struct gk20a *g,
150 return 0; 150 return 0;
151} 151}
152 152
153#ifdef CONFIG_DEBUG_FS
153void nvgpu_alloc_print_stats(struct nvgpu_allocator *__a, 154void nvgpu_alloc_print_stats(struct nvgpu_allocator *__a,
154 struct seq_file *s, int lock) 155 struct seq_file *s, int lock)
155{ 156{
156 __a->ops->print_stats(__a, s, lock); 157 __a->ops->print_stats(__a, s, lock);
157} 158}
158 159
159#ifdef CONFIG_DEBUG_FS
160static int __alloc_show(struct seq_file *s, void *unused) 160static int __alloc_show(struct seq_file *s, void *unused)
161{ 161{
162 struct nvgpu_allocator *a = s->private; 162 struct nvgpu_allocator *a = s->private;
diff --git a/drivers/gpu/nvgpu/common/mm/page_allocator.c b/drivers/gpu/nvgpu/common/mm/page_allocator.c
index 6fbdbedd..2ffff63d 100644
--- a/drivers/gpu/nvgpu/common/mm/page_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/page_allocator.c
@@ -742,6 +742,7 @@ static void nvgpu_page_allocator_destroy(struct nvgpu_allocator *__a)
742 alloc_unlock(__a); 742 alloc_unlock(__a);
743} 743}
744 744
745#ifdef CONFIG_DEBUG_FS
745static void nvgpu_page_print_stats(struct nvgpu_allocator *__a, 746static void nvgpu_page_print_stats(struct nvgpu_allocator *__a,
746 struct seq_file *s, int lock) 747 struct seq_file *s, int lock)
747{ 748{
@@ -788,6 +789,7 @@ static void nvgpu_page_print_stats(struct nvgpu_allocator *__a,
788 if (lock) 789 if (lock)
789 alloc_unlock(__a); 790 alloc_unlock(__a);
790} 791}
792#endif
791 793
792static const struct nvgpu_allocator_ops page_ops = { 794static const struct nvgpu_allocator_ops page_ops = {
793 .alloc = nvgpu_page_alloc, 795 .alloc = nvgpu_page_alloc,
@@ -807,7 +809,9 @@ static const struct nvgpu_allocator_ops page_ops = {
807 809
808 .fini = nvgpu_page_allocator_destroy, 810 .fini = nvgpu_page_allocator_destroy,
809 811
812#ifdef CONFIG_DEBUG_FS
810 .print_stats = nvgpu_page_print_stats, 813 .print_stats = nvgpu_page_print_stats,
814#endif
811}; 815};
812 816
813/* 817/*