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
This commit is contained in:
Terje Bergstrom
2017-04-21 12:42:57 -07:00
committed by mobile promotions
parent b88c9ad793
commit b3e1ce04b9
33 changed files with 89 additions and 22 deletions

View File

@@ -15,6 +15,7 @@
#include <linux/cdev.h>
#include <linux/uaccess.h>
#include <linux/fs.h>
#include <nvgpu/log2.h>

View File

@@ -18,6 +18,7 @@
#include <linux/cdev.h>
#include <linux/file.h>
#include <linux/anon_inodes.h>
#include <linux/fs.h>
#include <uapi/linux/nvgpu.h>
#include <nvgpu/bitops.h>

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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
};

View File

@@ -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
};
/*

View File

@@ -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,

View File

@@ -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;

View File

@@ -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
};
/*

View File

@@ -18,7 +18,9 @@
#include <linux/dma-mapping.h>
#include <linux/fs.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <linux/dma-buf.h>
#include <trace/events/gk20a.h>
@@ -1662,6 +1664,7 @@ int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd,
return 0;
}
#ifdef CONFIG_DEBUG_FS
static ssize_t gk20a_cde_reload_write(struct file *file,
const char __user *userbuf, size_t count, loff_t *ppos)
{
@@ -1694,3 +1697,4 @@ void gk20a_cde_debugfs_init(struct device *dev)
debugfs_create_file("reload_cde_firmware", S_IWUSR, platform->debugfs,
g, &gk20a_cde_reload_fops);
}
#endif

View File

@@ -11,13 +11,11 @@
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <nvgpu/kmem.h>
#include <nvgpu/dma.h>

View File

@@ -18,7 +18,9 @@
#include <linux/clk.h>
#include <linux/module.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <linux/clk/tegra.h>
#include "gk20a.h"

View File

@@ -15,7 +15,6 @@
#include <linux/kthread.h>
#include <linux/wait.h>
#include <linux/ktime.h>
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include <linux/poll.h>
#include <trace/events/gk20a.h>

View File

@@ -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,
@@ -24,7 +24,7 @@ struct channel_ctx_gk20a;
struct gk20a_ctxsw_dev;
struct gk20a_fecs_trace;
struct tsg_gk20a;
struct poll_table_struct;
int gk20a_ctxsw_dev_release(struct inode *inode, struct file *filp);
int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp);

View File

@@ -12,9 +12,12 @@
*
*/
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <linux/seq_file.h>
#include <linux/io.h>
#include <linux/fs.h>
#include <nvgpu/log.h>
#include <nvgpu/kmem.h>
@@ -298,8 +301,8 @@ int gk20a_railgating_debugfs_init(struct device *dev)
void gk20a_debug_init(struct device *dev, const char *debugfs_symlink)
{
struct gk20a_platform *platform = dev_get_drvdata(dev);
#ifdef CONFIG_DEBUG_FS
struct gk20a_platform *platform = dev_get_drvdata(dev);
struct gk20a *g = platform->g;
platform->debugfs = debugfs_create_dir(dev_name(dev), NULL);

View File

@@ -13,7 +13,9 @@
#include <asm/barrier.h>
#include <linux/kthread.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <nvgpu/kmem.h>
#include <nvgpu/dma.h>

View File

@@ -16,6 +16,7 @@
#include <linux/gk20a.h>
#include <linux/file.h>
#include <linux/version.h>
#include <linux/fs.h>
#include <nvgpu/semaphore.h>
#include <nvgpu/kmem.h>

View File

@@ -35,6 +35,9 @@ struct dbg_profiler_object_data;
#include <linux/irqreturn.h>
#include <linux/version.h>
#include <linux/cdev.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include "../../../arch/arm/mach-tegra/iomap.h"
@@ -150,7 +153,9 @@ struct gpu_ops {
struct zbc_entry *s_val,
u32 index);
void (*init_cbc)(struct gk20a *g, struct gr_gk20a *gr);
#ifdef CONFIG_DEBUG_FS
void (*sync_debugfs)(struct gk20a *g);
#endif
void (*init_fs_state)(struct gk20a *g);
void (*isr)(struct gk20a *g);
u32 (*cbc_fix_config)(struct gk20a *g, int base);
@@ -669,7 +674,9 @@ struct gpu_ops {
struct {
int (*init_therm_setup_hw)(struct gk20a *g);
int (*elcg_init_idle_filters)(struct gk20a *g);
#ifdef CONFIG_DEBUG_FS
void (*therm_debugfs_init)(struct gk20a *g);
#endif
int (*get_internal_sensor_curr_temp)(struct gk20a *g, u32 *temp_f24_8);
void (*get_internal_sensor_limits)(s32 *max_24_8,
s32 *min_24_8);
@@ -1140,7 +1147,9 @@ struct gk20a {
u32 tpc_fs_mask_user;
struct nvgpu_bios bios;
#ifdef CONFIG_DEBUG_FS
struct debugfs_blob_wrapper bios_blob;
#endif
struct nvgpu_clk_arb *clk_arb;

View File

@@ -17,7 +17,6 @@
*/
#include <linux/devfreq.h>
#include <linux/debugfs.h>
#include <linux/export.h>
#include <soc/tegra/chip-id.h>
#include <linux/pm_qos.h>

View File

@@ -17,7 +17,9 @@
*/
#include <linux/module.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <linux/uaccess.h>
#include <nvgpu/nvgpu_common.h>

View File

@@ -13,7 +13,9 @@
#include <asm/barrier.h>
#include <linux/wait.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <linux/uaccess.h>
#include <linux/poll.h>
#include <uapi/linux/nvgpu.h>

View File

@@ -17,6 +17,7 @@
struct gk20a;
struct gpu_ops;
struct tsg_gk20a;
struct poll_table_struct;
struct gk20a_sched_ctrl {
struct gk20a *g;

View File

@@ -1,9 +1,7 @@
/*
* drivers/video/tegra/host/gk20a/therm_gk20a.c
*
* GK20A Therm
*
* Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-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,
@@ -14,9 +12,8 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gk20a.h"
@@ -105,8 +102,10 @@ int gk20a_init_therm_support(struct gk20a *g)
if (err)
return err;
#ifdef CONFIG_DEBUG_FS
if (g->ops.therm.therm_debugfs_init)
g->ops.therm.therm_debugfs_init(g);
#endif
return err;
}

View File

@@ -256,7 +256,9 @@ int gm206_bios_init(struct gk20a *g)
{
unsigned int i;
struct gk20a_platform *platform = dev_get_drvdata(g->dev);
#ifdef CONFIG_DEBUG_FS
struct dentry *d;
#endif
struct nvgpu_firmware *bios_fw;
int err;
struct pci_dev *pdev = to_pci_dev(g->dev);
@@ -317,6 +319,7 @@ int gm206_bios_init(struct gk20a *g)
(g->pci_device_id == 0x1c75) &&
(g->gpu_characteristics.vbios_version == 0x86065300);
#ifdef CONFIG_DEBUG_FS
g->bios_blob.data = g->bios.data;
g->bios_blob.size = g->bios.size;
@@ -324,6 +327,7 @@ int gm206_bios_init(struct gk20a *g)
&g->bios_blob);
if (!d)
nvgpu_err(g, "No debugfs?");
#endif
gk20a_dbg_fn("done");

View File

@@ -11,8 +11,11 @@
* more details.
*/
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <nvgpu/types.h>
#include <linux/platform/tegra/mc.h>
#include <nvgpu/dma.h>

View File

@@ -18,8 +18,10 @@
#include <linux/version.h>
#include <linux/clk.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#endif
#include <linux/clk/tegra.h>
#include <soc/tegra/fuse.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))

View File

@@ -11,7 +11,9 @@
* more details.
*/
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <nvgpu/nvgpu_common.h>
#include <nvgpu/kmem.h>

View File

@@ -16,8 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#endif
#include <nvgpu/kmem.h>

View File

@@ -12,7 +12,9 @@
*/
#include "therm_gp106.h"
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include "therm/thrmpmu.h"
#include <nvgpu/hw/gp106/hw_therm_gp106.h>

View File

@@ -14,8 +14,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#endif
#include "gk20a/gk20a.h"
#include "gm206/bios_gm206.h"
@@ -498,6 +500,7 @@ static void xve_available_speeds_gp106(struct gk20a *g, u32 *speed_mask)
*speed_mask = GPU_XVE_SPEED_2P5 | GPU_XVE_SPEED_5P0;
}
#ifdef CONFIG_DEBUG_FS
static ssize_t xve_link_speed_write(struct file *filp,
const char __user *buff,
size_t len, loff_t *off)
@@ -621,6 +624,7 @@ static const struct file_operations xve_link_control_status_fops = {
.llseek = seq_lseek,
.release = single_release,
};
#endif
static int xve_sw_init_gp106(struct device *dev)
{

View File

@@ -17,7 +17,6 @@
#ifndef NVGPU_ALLOCATOR_H
#define NVGPU_ALLOCATOR_H
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/platform_device.h>
@@ -74,9 +73,11 @@ struct nvgpu_allocator_ops {
/* Destructor. */
void (*fini)(struct nvgpu_allocator *allocator);
#ifdef CONFIG_DEBUG_FS
/* Debugging. */
void (*print_stats)(struct nvgpu_allocator *allocator,
struct seq_file *s, int lock);
#endif
};
struct nvgpu_allocator {
@@ -246,8 +247,10 @@ u64 nvgpu_alloc_space(struct nvgpu_allocator *a);
void nvgpu_alloc_destroy(struct nvgpu_allocator *allocator);
#ifdef CONFIG_DEBUG_FS
void nvgpu_alloc_print_stats(struct nvgpu_allocator *a,
struct seq_file *s, int lock);
#endif
static inline struct gk20a *nvgpu_alloc_to_gpu(struct nvgpu_allocator *a)
{

View File

@@ -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,
@@ -14,7 +14,10 @@
#include "gk20a/gk20a.h"
#include "pwrdev.h"
#include "pmgrpmu.h"
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
int pmgr_pwr_devices_get_power(struct gk20a *g, u32 *val)
{