From b3e1ce04b963e91b9b425b3c35cc4eff11db7543 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 21 Apr 2017 12:42:57 -0700 Subject: 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 Reviewed-on: http://git-master/r/1467897 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/linux/ioctl_as.c | 1 + drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | 1 + drivers/gpu/nvgpu/common/linux/kmem.c | 2 +- drivers/gpu/nvgpu/common/linux/module.c | 4 +++- drivers/gpu/nvgpu/common/linux/pci.c | 2 ++ drivers/gpu/nvgpu/common/mm/bitmap_allocator.c | 4 ++++ drivers/gpu/nvgpu/common/mm/buddy_allocator.c | 4 ++++ drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 6 +++++- drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c | 2 +- drivers/gpu/nvgpu/common/mm/page_allocator.c | 4 ++++ 10 files changed, 26 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/common') 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 @@ #include #include +#include #include 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 @@ #include #include #include +#include #include #include 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, } } +#ifdef CONFIG_DEBUG_FS /** * nvgpu_kmem_print_stats - Print kmem tracking stats. * @@ -515,7 +516,6 @@ void nvgpu_kmem_print_stats(struct nvgpu_mem_alloc_tracker *tracker, unlock_tracker(tracker); } -#if defined(CONFIG_DEBUG_FS) static int __kmem_tracking_show(struct seq_file *s, void *unused) { 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) { struct gk20a_platform *platform = dev_get_drvdata(dev); int ret = 0; +#ifdef CONFIG_DEBUG_FS struct gk20a *g = get_gk20a(dev); -#ifdef CONFIG_DEBUG_FS g->pstats.last_rail_ungate_start = jiffies; if (g->pstats.railgating_cycle_count >= 1) g->pstats.total_rail_gate_time_ms = @@ -974,8 +974,10 @@ static int __exit gk20a_remove(struct platform_device *pdev) gk20a_user_deinit(dev, &nvgpu_class); +#ifdef CONFIG_DEBUG_FS debugfs_remove_recursive(platform->debugfs); debugfs_remove_recursive(platform->debugfs_alias); +#endif gk20a_remove_sysfs(dev); 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) gk20a_user_deinit(g->dev, &nvgpu_pci_class); gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b"); +#ifdef CONFIG_DEBUG_FS debugfs_remove_recursive(platform->debugfs); debugfs_remove_recursive(platform->debugfs_alias); +#endif gk20a_remove_sysfs(g->dev); 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) nvgpu_kfree(nvgpu_alloc_to_gpu(__a), a); } +#ifdef CONFIG_DEBUG_FS static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a, struct seq_file *s, int lock) { @@ -329,6 +330,7 @@ static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *__a, __alloc_pstat(s, __a, " Outstanding = 0x%llx\n", a->bytes_alloced - a->bytes_freed); } +#endif static const struct nvgpu_allocator_ops bitmap_ops = { .alloc = nvgpu_bitmap_alloc, @@ -344,7 +346,9 @@ static const struct nvgpu_allocator_ops bitmap_ops = { .fini = nvgpu_bitmap_alloc_destroy, +#ifdef CONFIG_DEBUG_FS .print_stats = nvgpu_bitmap_print_stats, +#endif }; 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) return space; } +#ifdef CONFIG_DEBUG_FS /* * Print the buddy allocator top level stats. If you pass @s as NULL then the * 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, if (lock) alloc_unlock(__a); } +#endif static const struct nvgpu_allocator_ops buddy_ops = { .alloc = nvgpu_buddy_balloc, @@ -1182,7 +1184,9 @@ static const struct nvgpu_allocator_ops buddy_ops = { .fini = nvgpu_buddy_allocator_destroy, +#ifdef CONFIG_DEBUG_FS .print_stats = nvgpu_buddy_print_stats, +#endif }; /* 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 @@ /* - * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * 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) nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa); } +#ifdef CONFIG_DEBUG_FS static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a, struct seq_file *s, int lock) { @@ -122,6 +123,7 @@ static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a, __alloc_pstat(s, a, " Number free = %d\n", pa->nr_nodes - atomic_read(&pa->nr_allocs)); } +#endif static const struct nvgpu_allocator_ops pool_ops = { .alloc = nvgpu_lockless_alloc, @@ -134,7 +136,9 @@ static const struct nvgpu_allocator_ops pool_ops = { .fini = nvgpu_lockless_alloc_destroy, +#ifdef CONFIG_DEBUG_FS .print_stats = nvgpu_lockless_print_stats, +#endif }; int 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, return 0; } +#ifdef CONFIG_DEBUG_FS void nvgpu_alloc_print_stats(struct nvgpu_allocator *__a, struct seq_file *s, int lock) { __a->ops->print_stats(__a, s, lock); } -#ifdef CONFIG_DEBUG_FS static int __alloc_show(struct seq_file *s, void *unused) { 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) alloc_unlock(__a); } +#ifdef CONFIG_DEBUG_FS static void nvgpu_page_print_stats(struct nvgpu_allocator *__a, struct seq_file *s, int lock) { @@ -788,6 +789,7 @@ static void nvgpu_page_print_stats(struct nvgpu_allocator *__a, if (lock) alloc_unlock(__a); } +#endif static const struct nvgpu_allocator_ops page_ops = { .alloc = nvgpu_page_alloc, @@ -807,7 +809,9 @@ static const struct nvgpu_allocator_ops page_ops = { .fini = nvgpu_page_allocator_destroy, +#ifdef CONFIG_DEBUG_FS .print_stats = nvgpu_page_print_stats, +#endif }; /* -- cgit v1.2.2