From 2ecd18902e29b8a3615f49afe3c51b2526816be7 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 10 Oct 2017 11:28:03 -0700 Subject: gpu: nvgpu: Use config in makefile for debug_kmem.c Conditionally compile debug_kmem.c in the Makefile since the entire file is not needed when CONFIG_NVGPU_TRACK_KMEM_USAGE is not enabled. Removing as many conditional compilation flags from the C code itself is highly desirable from a code complexity standard. Change-Id: If1e87986ca1ee6d71485f1ab40f10c1645c1a628 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1576543 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Makefile.nvgpu | 6 +++++- drivers/gpu/nvgpu/common/linux/debug_kmem.c | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/Makefile.nvgpu b/drivers/gpu/nvgpu/Makefile.nvgpu index 9ba6f49a..e059002a 100644 --- a/drivers/gpu/nvgpu/Makefile.nvgpu +++ b/drivers/gpu/nvgpu/Makefile.nvgpu @@ -137,10 +137,14 @@ nvgpu-$(CONFIG_DEBUG_FS) += \ common/linux/debug_mm.o \ common/linux/debug_allocator.o \ common/linux/debug_hal.o \ - common/linux/debug_kmem.o \ common/linux/debug_clk.o \ common/linux/debug_xve.o +ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y) +nvgpu-$(CONFIG_DEBUG_FS) += \ + common/linux/debug_kmem.o +endif + nvgpu-$(CONFIG_TEGRA_GK20A) += common/linux/platform_gk20a_tegra.o nvgpu-$(CONFIG_SYNC) += gk20a/sync_gk20a.o nvgpu-$(CONFIG_GK20A_PCI) += common/linux/pci.o diff --git a/drivers/gpu/nvgpu/common/linux/debug_kmem.c b/drivers/gpu/nvgpu/common/linux/debug_kmem.c index 04fb8b68..a0c7d47d 100644 --- a/drivers/gpu/nvgpu/common/linux/debug_kmem.c +++ b/drivers/gpu/nvgpu/common/linux/debug_kmem.c @@ -18,7 +18,6 @@ #include "debug_kmem.h" #include "kmem_priv.h" -#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE /** * to_human_readable_bytes - Determine suffix for passed size. * @@ -311,4 +310,3 @@ void nvgpu_kmem_debugfs_init(struct gk20a *g) l->debugfs_kmem, g, &__kmem_traces_fops); } -#endif -- cgit v1.2.2