From 9db45cf0376c6de8d71cc8087d0ec76dff72c00b Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Fri, 19 May 2017 09:17:29 -0700 Subject: gpu: nvgpu: Fix build failure in allocator.h Fix a build failure caused by missing definition for struct device. Instead of including device.h wrap the debugfs init function with CONFIG_DEBUG_FS and forward declare struct device. We don't use any struct device internals here so we only need to let the compiler know that this type does exist. Bug 200310575 Change-Id: I1ae45a8f191d920d9b606fefd5029fad84869cff Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1486012 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c | 4 ++-- drivers/gpu/nvgpu/include/nvgpu/allocator.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c index a3c4e3b6..211b353b 100644 --- a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c @@ -201,9 +201,9 @@ void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a) #endif } +#ifdef CONFIG_DEBUG_FS void nvgpu_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); @@ -214,5 +214,5 @@ void nvgpu_alloc_debugfs_init(struct device *dev) debugfs_create_u32("tracing", 0664, g->debugfs_allocators, &nvgpu_alloc_tracing_on); -#endif } +#endif diff --git a/drivers/gpu/nvgpu/include/nvgpu/allocator.h b/drivers/gpu/nvgpu/include/nvgpu/allocator.h index 4eb76985..3579b0fb 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/allocator.h @@ -281,7 +281,10 @@ static inline void nvgpu_alloc_disable_dbg(struct nvgpu_allocator *a) */ extern u32 nvgpu_alloc_tracing_on; +#ifdef CONFIG_DEBUG_FS +struct device; void nvgpu_alloc_debugfs_init(struct device *dev); +#endif #define nvgpu_alloc_trace_func() \ do { \ -- cgit v1.2.2