summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-03-15 08:16:07 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-30 15:36:26 -0400
commit8aa218e0ec54bfca3ad6d6d67a3b936c56335644 (patch)
treea7275093afd27149ec4f0d052cad9f5bd4176750
parent6c3370a588108ba920c952d63699670905e16449 (diff)
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 <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1321296 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/pstate/pstate.c12
-rw-r--r--drivers/gpu/nvgpu/pstate/pstate.h1
3 files changed, 16 insertions, 1 deletions
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)
459 if (g->ops.clk.suspend_clk_support) 459 if (g->ops.clk.suspend_clk_support)
460 ret |= g->ops.clk.suspend_clk_support(g); 460 ret |= g->ops.clk.suspend_clk_support(g);
461 461
462#ifdef CONFIG_ARCH_TEGRA_18x_SOC
463 if (g->ops.pmupstate)
464 gk20a_deinit_pstate_support(g);
465#endif
462 g->power_on = false; 466 g->power_on = false;
463 467
464 /* Decrement platform power refcount */ 468 /* 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 @@
24 24
25static int pstate_sw_setup(struct gk20a *g); 25static int pstate_sw_setup(struct gk20a *g);
26 26
27void gk20a_deinit_pstate_support(struct gk20a *g)
28{
29 nvgpu_mutex_destroy(&g->perf_pmu.pstatesobjs.pstate_mutex);
30}
31
27/*sw setup for pstate components*/ 32/*sw setup for pstate components*/
28int gk20a_init_pstate_support(struct gk20a *g) 33int gk20a_init_pstate_support(struct gk20a *g)
29{ 34{
@@ -333,7 +338,10 @@ static int pstate_sw_setup(struct gk20a *g)
333 gk20a_dbg_fn(""); 338 gk20a_dbg_fn("");
334 339
335 init_waitqueue_head(&g->perf_pmu.pstatesobjs.pstate_notifier_wq); 340 init_waitqueue_head(&g->perf_pmu.pstatesobjs.pstate_notifier_wq);
336 nvgpu_mutex_init(&g->perf_pmu.pstatesobjs.pstate_mutex); 341
342 err = nvgpu_mutex_init(&g->perf_pmu.pstatesobjs.pstate_mutex);
343 if (err)
344 return err;
337 345
338 err = boardobjgrpconstruct_e32(&g->perf_pmu.pstatesobjs.super); 346 err = boardobjgrpconstruct_e32(&g->perf_pmu.pstatesobjs.super);
339 if (err) { 347 if (err) {
@@ -364,6 +372,8 @@ static int pstate_sw_setup(struct gk20a *g)
364 372
365 err = parse_pstate_table_5x(g, hdr); 373 err = parse_pstate_table_5x(g, hdr);
366done: 374done:
375 if (err)
376 nvgpu_mutex_destroy(&g->perf_pmu.pstatesobjs.pstate_mutex);
367 return err; 377 return err;
368} 378}
369 379
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 {
54}; 54};
55 55
56int gk20a_init_pstate_support(struct gk20a *g); 56int gk20a_init_pstate_support(struct gk20a *g);
57void gk20a_deinit_pstate_support(struct gk20a *g);
57int gk20a_init_pstate_pmu_support(struct gk20a *g); 58int gk20a_init_pstate_pmu_support(struct gk20a *g);
58 59
59struct clk_set_info *pstate_get_clk_set_info(struct gk20a *g, u32 pstate_num, 60struct clk_set_info *pstate_get_clk_set_info(struct gk20a *g, u32 pstate_num,