From 8aa218e0ec54bfca3ad6d6d67a3b936c56335644 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 15 Mar 2017 17:46:07 +0530 Subject: gpu: nvgpu: check return value of mutex_init in pstate.c - check return value of nvgpu_mutex_init in pstate.c - add new callback gk20a_deinit_pstate_support() to deinitialize pstate support - add corresponding nvgpu_mutex_destroy calls Jira NVGPU-13 Change-Id: I206bf2324e8fe95f4ed52c29ac5d8981327632b2 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1321296 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gk20a.c | 4 ++++ drivers/gpu/nvgpu/pstate/pstate.c | 12 +++++++++++- drivers/gpu/nvgpu/pstate/pstate.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index aae3072a..060429d1 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -459,6 +459,10 @@ static int gk20a_pm_prepare_poweroff(struct device *dev) if (g->ops.clk.suspend_clk_support) ret |= g->ops.clk.suspend_clk_support(g); +#ifdef CONFIG_ARCH_TEGRA_18x_SOC + if (g->ops.pmupstate) + gk20a_deinit_pstate_support(g); +#endif g->power_on = false; /* Decrement platform power refcount */ diff --git a/drivers/gpu/nvgpu/pstate/pstate.c b/drivers/gpu/nvgpu/pstate/pstate.c index dcb8464c..41c06a8a 100644 --- a/drivers/gpu/nvgpu/pstate/pstate.c +++ b/drivers/gpu/nvgpu/pstate/pstate.c @@ -24,6 +24,11 @@ static int pstate_sw_setup(struct gk20a *g); +void gk20a_deinit_pstate_support(struct gk20a *g) +{ + nvgpu_mutex_destroy(&g->perf_pmu.pstatesobjs.pstate_mutex); +} + /*sw setup for pstate components*/ int gk20a_init_pstate_support(struct gk20a *g) { @@ -333,7 +338,10 @@ static int pstate_sw_setup(struct gk20a *g) gk20a_dbg_fn(""); init_waitqueue_head(&g->perf_pmu.pstatesobjs.pstate_notifier_wq); - nvgpu_mutex_init(&g->perf_pmu.pstatesobjs.pstate_mutex); + + err = nvgpu_mutex_init(&g->perf_pmu.pstatesobjs.pstate_mutex); + if (err) + return err; err = boardobjgrpconstruct_e32(&g->perf_pmu.pstatesobjs.super); if (err) { @@ -364,6 +372,8 @@ static int pstate_sw_setup(struct gk20a *g) err = parse_pstate_table_5x(g, hdr); done: + if (err) + nvgpu_mutex_destroy(&g->perf_pmu.pstatesobjs.pstate_mutex); return err; } diff --git a/drivers/gpu/nvgpu/pstate/pstate.h b/drivers/gpu/nvgpu/pstate/pstate.h index 22ba98b9..406f4226 100644 --- a/drivers/gpu/nvgpu/pstate/pstate.h +++ b/drivers/gpu/nvgpu/pstate/pstate.h @@ -54,6 +54,7 @@ struct pstates { }; int gk20a_init_pstate_support(struct gk20a *g); +void gk20a_deinit_pstate_support(struct gk20a *g); int gk20a_init_pstate_pmu_support(struct gk20a *g); struct clk_set_info *pstate_get_clk_set_info(struct gk20a *g, u32 pstate_num, -- cgit v1.2.2