From 269fe8bea6e5f2e76dbd4dab1c2a06245f3ad46c Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Fri, 3 Jan 2020 17:34:00 -0500 Subject: [PATCH] gpu: nvgpu: compile channel dbg_s_* only for debugger Channel's dbg_s_lock and dbg_s_list are only needed when CONFIG_NVGPU_DEBUGGER is defined. Conditionally compile those fields, so that they are not present in safety build and related documentation. Jira NVGPU-4376 Change-Id: Ie2e99a39e5cbb60fb05d3eccc4c57242f0eef303 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/2273262 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert GVS: Gerrit_Virtual_Submit Reviewed-by: Philip Elcan Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 6 +++++- drivers/gpu/nvgpu/include/nvgpu/channel.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index b5181de07..6ce16aeb1 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -2485,7 +2485,9 @@ static void nvgpu_channel_destroy(struct nvgpu_channel *c) nvgpu_mutex_destroy(&c->cyclestate.cyclestate_buffer_mutex); nvgpu_mutex_destroy(&c->cs_client_mutex); #endif +#if defined(CONFIG_NVGPU_DEBUGGER) nvgpu_mutex_destroy(&c->dbg_s_lock); +#endif } void nvgpu_channel_cleanup_sw(struct gk20a *g) @@ -2549,14 +2551,16 @@ int nvgpu_channel_init_support(struct gk20a *g, u32 chid) nvgpu_mutex_init(&c->joblist.pre_alloc.read_lock); #endif /* CONFIG_NVGPU_KERNEL_MODE_SUBMIT */ - nvgpu_init_list_node(&c->dbg_s_list); nvgpu_mutex_init(&c->ioctl_lock); nvgpu_mutex_init(&c->sync_lock); #if defined(CONFIG_NVGPU_CYCLESTATS) nvgpu_mutex_init(&c->cyclestate.cyclestate_buffer_mutex); nvgpu_mutex_init(&c->cs_client_mutex); #endif +#if defined(CONFIG_NVGPU_DEBUGGER) + nvgpu_init_list_node(&c->dbg_s_list); nvgpu_mutex_init(&c->dbg_s_lock); +#endif nvgpu_init_list_node(&c->ch_entry); nvgpu_list_add(&c->free_chs, &g->fifo.free_chs); diff --git a/drivers/gpu/nvgpu/include/nvgpu/channel.h b/drivers/gpu/nvgpu/include/nvgpu/channel.h index 800ac74da..b028f1a58 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/channel.h +++ b/drivers/gpu/nvgpu/include/nvgpu/channel.h @@ -479,10 +479,12 @@ struct nvgpu_channel { struct nvgpu_mutex cs_client_mutex; struct gk20a_cs_snapshot_client *cs_client; #endif +#ifdef CONFIG_NVGPU_DEBUGGER /** Channel's debugger session lock. */ struct nvgpu_mutex dbg_s_lock; /** Channel entry in debugger session's list. */ struct nvgpu_list_node dbg_s_list; +#endif /** Syncpoint lock to allocate fences. */ struct nvgpu_mutex sync_lock;